-
Notifications
You must be signed in to change notification settings - Fork 1
/
Module.php
53 lines (43 loc) · 1.17 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
<?php
namespace dongrim\language;
use Yii;
/**
* language module definition class
*/
class Module extends \yii\base\Module
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'dongrim\language\controllers';
public $customWidgetView = '@dongrim/language/widgets/views/lang/view';
/**
* @inheritdoc
*/
public function init()
{
$this->registerAssets();
parent::init();
// custom initialization code goes here
}
private $_view;
/**
* Returns the view object that can be used to render views or view files.
* The [[render()]] and [[renderFile()]] methods will use
* this view object to implement the actual view rendering.
* If not set, it will default to the "view" application component.
* @return \yii\web\View the view object that can be used to render views or view files.
*/
public function getView()
{
if ($this->_view === null) {
$this->_view = Yii::$app->getView();
}
return $this->_view;
}
protected function registerAssets()
{
$view = $this->getView();
LanguageAsset::register($view);
}
}