-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathModule.php
55 lines (47 loc) · 1.18 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* @link https://github.com/Chiliec/yii2-vote
* @author Vladimir Babin <[email protected]>
* @license http://opensource.org/licenses/BSD-3-Clause
*/
namespace chiliec\vote;
use yii\base\InvalidConfigException;
use Yii;
class Module extends \yii\base\Module
{
public $controllerNamespace = 'chiliec\vote\controllers';
/**
* Is allow vote for guests
* @var bool
*/
public $allowGuests = true;
/**
* Is enable popover
* @var bool
*/
public $popOverEnabled = true;
/**
* Is allow change votes
* @var bool
*/
public $allowChangeVote = true;
/**
* Matching models with integer id's
* @var array
*/
public $models;
public function init()
{
parent::init();
if (!isset($this->models)) {
throw new InvalidConfigException('models not configurated');
}
if (empty(Yii::$app->i18n->translations['vote'])) {
Yii::$app->i18n->translations['vote'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => __DIR__ . '/messages',
];
}
}
}