-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSmartWebModule.php
43 lines (39 loc) · 936 Bytes
/
SmartWebModule.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
<?php
/**
* @author Alexey Samoylov <[email protected]>
*
* @package YiiSmart
* @version 1.0
*/
/**
* Class SmartWebModule
*/
class SmartWebModule extends CWebModule
{
public $modifyBreadcrumbs = true;
public function init()
{
parent::init();
$this->setImport([
"{$this->id}.models.*",
"{$this->id}.controllers.*",
"{$this->id}.components.*",
]);
}
/**
* @param SmartController $controller
* @param CAction $action
* @return bool
*/
public function beforeControllerAction($controller, $action)
{
if(parent::beforeControllerAction($controller, $action))
{
if ($this->modifyBreadcrumbs == true)
$controller->breadcrumbs[Yii::t('app', ucfirst($this->id).' Module')] = ["//{$this->id}"];
return true;
}
else
return false;
}
}