-
Notifications
You must be signed in to change notification settings - Fork 1
/
Module.php
63 lines (53 loc) · 1.79 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
56
57
58
59
60
61
62
63
<?php
namespace thyseus\favorites;
use Yii;
use yii\i18n\PhpMessageSource;
/**
* Favorites module definition class
*/
class Module extends \yii\base\Module
{
public $version = '0.2.0-dev';
public $icon_active = '<i class="glyphicon glyphicon-star-empty"></i>';
public $icon_inactive = '<i class="glyphicon glyphicon-star"></i>';
/**
* @inheritdoc
*/
public $controllerNamespace = 'thyseus\favorites\controllers';
public $defaultRoute = 'favorites\favorites\index';
/**
* @var string The class of the User Model inside the application this module is attached to
*/
public $userModelClass = 'app\models\User';
/** @var array The rules to be used in URL management. */
public $urlRules = [
'favorites/update/<id>' => 'favorites/favorites/update',
'favorites/delete/<id>' => 'favorites/favorites/delete',
'favorites/<id>' => 'favorites/favorites/view',
'favorites/index' => 'favorites/favorites/index',
'favorites/create' => 'favorites/favorites/create',
];
/** @var array Model aliases.
* For example:
* 'modelAliases' => [
* 'app\models\Offer' => 'Offer',
* 'app\models\Agency' => 'Agency',
* 'app\models\Merchant' => 'Merchant',
* 'app\models\ContactPerson' => Yii::t('some translation', 'Contact person'),
* ], */
public $modelAliases = [];
/**
* @inheritdoc
*/
public function init()
{
if (!isset(Yii::$app->get('i18n')->translations['favorites*'])) {
Yii::$app->get('i18n')->translations['favorites*'] = [
'class' => PhpMessageSource::className(),
'basePath' => __DIR__ . '/messages',
'sourceLanguage' => 'en-US'
];
}
parent::init();
}
}