-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule.php
97 lines (81 loc) · 2.19 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace stronglab\dashboard;
/**
* @author strong
*/
use Yii;
class Module extends \yii\base\Module
{
/**
* @var array Allowed roles. Guest by default
*/
public $roles = ['?'];
/**
* @var int dashboard column num
*/
public $column = 1;
/**
*
* @var string Alias for module
*/
public $alias = '@dashboard';
/**
*
* @var string Default icon for dashboard
*/
public $glyphiconDefault = 'cog';
/**
*
* @var array List available module for dashboard
*/
public $modules = [];
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// set alias
$this->setAliases([
$this->alias => __DIR__,
]);
//set components
$this->setComponents([
'config' => [
'class' => 'stronglab\dashboard\components\ConfigComponent',
'modules' => $this->modules,
'glyphiconDefault' => $this->glyphiconDefault,
'dashboardId' => $this->id,
],
]);
$this->registerTranslations();
}
/**
* Registeration translation files.
*/
public function registerTranslations()
{
Yii::$app->i18n->translations['stronglab/dashboard/*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en',
'forceTranslation' => true,
'basePath' => '@stronglab/dashboard/messages',
'fileMap' => [
'stronglab/dashboard/core' => 'core.php',
],
];
}
/**
* Translates a message to the specified language.
*
* @param string $message the message to be translated.
* @param array $params the parameters that will be used to replace the corresponding placeholders in the message.
* @param string $language the language code (e.g. `en-US`, `en`). If this is null, the current application language
* will be used.
* @return string
*/
public static function t($message, $params = [], $language = null)
{
return Yii::t('stronglab/dashboard/core', $message, $params, $language);
}
}