1 | <?php |
||
20 | class ThemeConfig extends BaseObject implements Arrayable |
||
21 | { |
||
22 | use ArrayableTrait; |
||
23 | |||
24 | protected $_basePath; |
||
25 | |||
26 | /** |
||
27 | * @var string The pretty name of the theme. |
||
28 | */ |
||
29 | public $name; |
||
30 | |||
31 | /** |
||
32 | * @var string Base path (or alias) of the parent theme. |
||
33 | */ |
||
34 | public $parentTheme; |
||
35 | |||
36 | /** |
||
37 | * @var array Additional path to override by this theme. |
||
38 | * @see \luya\theme\Theme::getAdditionalPathMap |
||
39 | */ |
||
40 | public $pathMap = []; |
||
41 | |||
42 | /** |
||
43 | * @var string Some information about the theme. |
||
44 | */ |
||
45 | public $description; |
||
46 | |||
47 | /** |
||
48 | * ThemeConfig constructor with base path of the theme directory and config as array. |
||
49 | * |
||
50 | * @param string $basePath The base path of the theme. |
||
51 | * @param array $config key-value pair |
||
52 | * |
||
53 | * @throws InvalidConfigException |
||
54 | */ |
||
55 | public function __construct(string $basePath, array $config) |
||
65 | |||
66 | /** |
||
67 | * @inheritDoc |
||
68 | */ |
||
69 | public function init() |
||
77 | |||
78 | protected $_parent; |
||
79 | |||
80 | /** |
||
81 | * Load the config of the parent theme. |
||
82 | * |
||
83 | * @return ThemeConfig |
||
84 | * @throws InvalidConfigException |
||
85 | * @throws \luya\Exception |
||
86 | */ |
||
87 | public function getParent() |
||
95 | |||
96 | /** |
||
97 | * Set the parent theme config. Is only required while initialize this class. |
||
98 | * |
||
99 | * @param ThemeConfig $themeConfig |
||
100 | */ |
||
101 | protected function setParent(ThemeConfig $themeConfig) |
||
105 | |||
106 | /** |
||
107 | * Load all parent themes recursive in a ordered array. First entry is the parent of this theme, seconds entry is the parent of the parent and so on. |
||
108 | * |
||
109 | * @return array |
||
110 | * @throws InvalidConfigException |
||
111 | * @throws \luya\Exception |
||
112 | */ |
||
113 | public function getParents() |
||
125 | |||
126 | /** |
||
127 | * Base path (or alias) to the theme directory. |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function getBasePath() |
||
135 | |||
136 | /** |
||
137 | * Path to view directory of the theme. |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getViewPath() |
||
145 | } |