1 | <?php |
||
28 | class MenuOptions |
||
29 | { |
||
30 | /** @var string $action overrides the default action */ |
||
31 | private $action = ''; |
||
32 | |||
33 | /** @var string $area overrides the current area */ |
||
34 | private $area = ''; |
||
35 | |||
36 | /** @var array $extraUrlParameters an array or pairs or parameters to be added to the url */ |
||
37 | private $extraUrlParameters = []; |
||
38 | |||
39 | /** @var boolean $disableUrlSessionCheck if true the session var/id are omitted from the url */ |
||
40 | private $disableUrlSessionCheck = false; |
||
41 | |||
42 | /** @var string $baseUrl an alternative base url */ |
||
43 | private $baseUrl = ''; |
||
44 | |||
45 | /** @var string $menuType alternative menu type to replace the usual sidebar/dropdown. */ |
||
46 | private $menuType = ''; |
||
47 | |||
48 | /** @var boolean $canToggleDropDown if the menu can toggle between sidebar and dropdown. */ |
||
49 | private $canToggleDropDown = true; |
||
50 | |||
51 | /** @var string $templateName an alternative template to load (instead of Generic) */ |
||
52 | private $templateName = 'GenericMenu'; |
||
53 | |||
54 | /** @var string $layerName alternative layer name for the menu */ |
||
55 | private $layerName = 'generic_menu'; |
||
56 | |||
57 | /** @var array $counters All the counters to be used for a menu. See Menu::parseCounter() */ |
||
58 | private $counters = []; |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | 41 | public function getAction(): string |
|
67 | |||
68 | /** |
||
69 | * @param string $action |
||
70 | */ |
||
71 | 41 | public function setAction(string $action) |
|
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | 40 | public function getArea(): string |
|
83 | |||
84 | /** |
||
85 | * @param string $area |
||
86 | */ |
||
87 | 6 | public function setArea(string $area) |
|
91 | |||
92 | /** |
||
93 | * @return array |
||
94 | */ |
||
95 | 40 | public function getExtraUrlParameters(): array |
|
99 | |||
100 | /** |
||
101 | * @param array $extraUrlParameters |
||
102 | */ |
||
103 | 40 | public function setExtraUrlParameters(array $extraUrlParameters) |
|
107 | |||
108 | /** |
||
109 | * @return bool |
||
110 | */ |
||
111 | 40 | public function isUrlSessionCheckDisabled(): bool |
|
115 | |||
116 | /** |
||
117 | * @param bool $disableUrlSessionCheck |
||
118 | */ |
||
119 | 1 | public function setDisableUrlSessionCheck(bool $disableUrlSessionCheck) |
|
123 | |||
124 | /** |
||
125 | * @return string |
||
126 | */ |
||
127 | 41 | public function getBaseUrl(): string |
|
131 | |||
132 | /** |
||
133 | * @param string $baseUrl |
||
134 | */ |
||
135 | 41 | public function setBaseUrl(string $baseUrl) |
|
139 | |||
140 | /** |
||
141 | * @return string |
||
142 | */ |
||
143 | 41 | public function getMenuType(): string |
|
147 | |||
148 | /** |
||
149 | * @param string $menuType |
||
150 | */ |
||
151 | 41 | public function setMenuType(string $menuType) |
|
155 | |||
156 | /** |
||
157 | * @return bool |
||
158 | */ |
||
159 | 38 | public function isDropDownToggleable(): bool |
|
163 | |||
164 | /** |
||
165 | * @param bool $canToggleDropDown |
||
166 | */ |
||
167 | 41 | public function setCanToggleDropDown(bool $canToggleDropDown) |
|
171 | |||
172 | /** |
||
173 | * @return string |
||
174 | */ |
||
175 | 38 | public function getTemplateName(): string |
|
179 | |||
180 | /** |
||
181 | * @param string $templateName |
||
182 | */ |
||
183 | public function setTemplateName(string $templateName) |
||
187 | |||
188 | /** |
||
189 | * @return string |
||
190 | */ |
||
191 | 41 | public function getLayerName(): string |
|
195 | |||
196 | /** |
||
197 | * @param string $layerName |
||
198 | */ |
||
199 | 41 | public function setLayerName(string $layerName) |
|
203 | |||
204 | /** |
||
205 | * @return array |
||
206 | */ |
||
207 | 38 | public function getCounters(): array |
|
211 | |||
212 | /** |
||
213 | * @param array $counters |
||
214 | */ |
||
215 | 2 | public function setCounters(array $counters) |
|
219 | |||
220 | /** |
||
221 | * Add an array of options for a menu. |
||
222 | * |
||
223 | * @param array $arr Options as an array. Keys should match properties |
||
224 | * of MenuOptions and can be either in snake_case or in camelCase, |
||
225 | * depending on your style. |
||
226 | * |
||
227 | * @return MenuOptions |
||
228 | */ |
||
229 | 41 | public static function buildFromArray(array $arr): MenuOptions |
|
244 | |||
245 | /** |
||
246 | * The theme needs some love, too. |
||
247 | */ |
||
248 | 41 | private function buildTemplateVars(): void |
|
260 | |||
261 | /** |
||
262 | * Process the array of MenuOptions passed to the class |
||
263 | */ |
||
264 | 41 | protected function buildBaseUrl(): void |
|
278 | |||
279 | /** |
||
280 | * Build the additional parameters for use in the url |
||
281 | * |
||
282 | * @return string |
||
283 | */ |
||
284 | 40 | public function buildAdditionalParams(): string |
|
308 | } |
||
309 |