1 | <?php |
||
20 | class Theme extends \yii\base\Theme implements \hiqdev\yii2\collection\ItemWithNameInterface |
||
21 | { |
||
22 | use GetManagerTrait; |
||
23 | |||
24 | /** |
||
25 | * @var string theme name |
||
26 | */ |
||
27 | public $name; |
||
28 | |||
29 | /** |
||
30 | * @var string theme label |
||
31 | */ |
||
32 | public $label; |
||
33 | |||
34 | /** |
||
35 | * @var array assets to be registered for this theme |
||
36 | */ |
||
37 | public $assets = []; |
||
38 | |||
39 | private $_view; |
||
40 | |||
41 | /** |
||
42 | * Returns the view object that can be used to render views or view files. |
||
43 | * The [[render()]] and [[renderFile()]] methods will use |
||
44 | * this view object to implement the actual view rendering. |
||
45 | * If not set, it will default to the "view" application component. |
||
46 | * |
||
47 | * @return \yii\web\View the view object that can be used to render views or view files |
||
48 | */ |
||
49 | public function getView() |
||
57 | |||
58 | /** |
||
59 | * Sets the view object to be used. |
||
60 | * |
||
61 | * @param View $view the view object that can be used to render views or view files |
||
62 | */ |
||
63 | public function setView($view) |
||
67 | |||
68 | public $pathMap = []; |
||
69 | |||
70 | /** |
||
71 | * Getter for pathMap. |
||
72 | */ |
||
73 | public function init() |
||
74 | { |
||
75 | parent::init(); |
||
76 | if (!is_array($this->pathMap)) { |
||
77 | $this->pathMap = []; |
||
78 | } |
||
79 | |||
80 | $this->pathMap = $this->compilePathMap(ArrayHelper::merge([ |
||
81 | '$themedViewPaths' => $this->buildThemedViewPaths(), |
||
82 | '$themedWidgetPaths' => '$themedViewPaths/widgets', |
||
83 | Yii::$app->viewPath => '$themedViewPaths', |
||
84 | __DIR__ . '/widgets/views' => '$themedWidgetPaths', |
||
85 | ], $this->getManager()->pathMap, $this->pathMap)); |
||
86 | } |
||
87 | |||
88 | public function compilePathMap($map) |
||
103 | |||
104 | public function substituteVars($vars) |
||
128 | |||
129 | public function isVar($name) |
||
133 | |||
134 | public function calcExp($exp, $vars) |
||
146 | |||
147 | public function buildThemedViewPaths() |
||
153 | |||
154 | public function findParentPaths() |
||
168 | |||
169 | protected $_reflection; |
||
170 | |||
171 | public function getReflection() |
||
179 | |||
180 | private $_settings; |
||
181 | |||
182 | /** |
||
183 | * @param string $settings theme settings model class name or config |
||
184 | */ |
||
185 | public function setSettings($settings) |
||
189 | |||
190 | public function getSettings() |
||
203 | |||
204 | public static function calcSettingsClass($class) |
||
208 | |||
209 | public static function findSettingsClass($class) |
||
215 | |||
216 | public function getDetailedTheme() |
||
227 | } |
||
228 |