1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* BB's Zend Framework 2 Components |
4
|
|
|
* |
5
|
|
|
* UI Components |
6
|
|
|
* |
7
|
|
|
* @package [MyApplication] |
8
|
|
|
* @subpackage BB's Zend Framework 2 Components |
9
|
|
|
* @subpackage UI Components |
10
|
|
|
* @author Björn Bartels <[email protected]> |
11
|
|
|
* @link https://gitlab.bjoernbartels.earth/groups/zf2 |
12
|
|
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 |
13
|
|
|
* @copyright copyright (c) 2016 Björn Bartels <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace UIComponents\View\Helper\Navigation; |
17
|
|
|
|
18
|
|
|
use \RecursiveIteratorIterator; |
|
|
|
|
19
|
|
|
use \Zend\Navigation\AbstractContainer; |
|
|
|
|
20
|
|
|
use \Zend\Navigation\Page\AbstractPage; |
|
|
|
|
21
|
|
|
use \Zend\View\Exception; |
|
|
|
|
22
|
|
|
use \UIComponents\View\Helper\Traits\ComponentClassnamesTrait; |
|
|
|
|
23
|
|
|
use \UIComponents\View\Helper\Traits\ComponentAttributesTrait; |
|
|
|
|
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* |
27
|
|
|
* Helper for recursively rendering 'Bootstrap' compatible multi-level menus |
28
|
|
|
* |
29
|
|
|
*/ |
30
|
|
|
class Menu extends \Zend\View\Helper\Navigation\Menu |
31
|
|
|
{ |
32
|
|
|
use ComponentClassnamesTrait; |
33
|
|
|
use ComponentAttributesTrait; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* default CSS class to use for li elements |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
protected $defaultLiClass = ''; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* CSS class to use for the ul sub-menu element |
44
|
|
|
* |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
protected $subUlClass = 'dropdown-menu'; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* CSS class to use for the 1. level (NOT root level!) ul sub-menu element |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
protected $subUlClassLevel1 = 'dropdown-menu'; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* CSS class to use for the active li sub-menu element |
58
|
|
|
* |
59
|
|
|
* @var string |
60
|
|
|
*/ |
61
|
|
|
protected $subLiClass = 'dropdown-submenu'; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* CSS class to use for the active li sub-menu element |
65
|
|
|
* |
66
|
|
|
* @var string |
67
|
|
|
*/ |
68
|
|
|
protected $subLiClassLevel0 = 'dropdown'; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* CSS class prefix to use for the menu element's icon class |
72
|
|
|
* |
73
|
|
|
* @var string |
74
|
|
|
*/ |
75
|
|
|
protected $iconPrefixClass = 'icon-'; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* HREF string to use for the sub-menu toggle element's HREF attribute, |
79
|
|
|
* to override current page's href/'htmlify' setting |
80
|
|
|
* |
81
|
|
|
* @var string |
82
|
|
|
*/ |
83
|
|
|
protected $hrefSubToggleOverride = null; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Partial view script to use for rendering menu link/item |
87
|
|
|
* |
88
|
|
|
* @var string|array |
89
|
|
|
*/ |
90
|
|
|
protected $htmlifyPartial = null; |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* View helper entry point: |
96
|
|
|
* Retrieves helper and optionally sets container to operate on |
97
|
|
|
* |
98
|
|
|
* @param AbstractContainer $container [optional] container to operate on |
99
|
|
|
* @return self |
100
|
|
|
*/ |
101
|
|
|
public function __invoke($container = null) |
102
|
|
|
{ |
103
|
|
|
if (null !== $container) { |
104
|
|
|
$this->setContainer($container); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Returns the navigation container helper operates on by default |
112
|
|
|
* |
113
|
|
|
* Implements {@link HelperInterface::getContainer()}. |
114
|
|
|
* |
115
|
|
|
* If no container is set, a new container will be instantiated and |
116
|
|
|
* stored in the helper. |
117
|
|
|
* |
118
|
|
|
* @return Navigation\AbstractContainer navigation container |
|
|
|
|
119
|
|
|
*/ |
120
|
|
|
public function getContainer() |
121
|
|
|
{ |
122
|
|
|
if (null === $this->container) { |
123
|
|
|
$this->container = new \UIComponents\Navigation\Navigation(); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
return $this->container; |
|
|
|
|
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Renders helper |
131
|
|
|
* |
132
|
|
|
* Renders a HTML 'ul' for the given $container. If $container is not given, |
133
|
|
|
* the container registered in the helper will be used. |
134
|
|
|
* |
135
|
|
|
* Available $options: |
136
|
|
|
* |
137
|
|
|
* |
138
|
|
|
* @param AbstractContainer $container [optional] container to create menu from. |
139
|
|
|
* Default is to use the container retrieved |
140
|
|
|
* from {@link getContainer()}. |
141
|
|
|
* @param array $options [optional] options for controlling rendering |
142
|
|
|
* @return string |
143
|
|
|
*/ |
144
|
|
|
public function renderMenu($container = null, array $options = []) |
145
|
|
|
{ |
146
|
|
|
$this->parseContainer($container); |
147
|
|
|
if (null === $container) { |
148
|
|
|
$container = $this->getContainer(); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
|
152
|
|
|
$options = $this->normalizeOptions($options); |
153
|
|
|
|
154
|
|
|
if ($options['onlyActiveBranch'] && !$options['renderParents']) { |
155
|
|
|
$html = $this->renderDeepestMenu( |
156
|
|
|
$container, |
157
|
|
|
$options['ulClass'], |
158
|
|
|
$options['indent'], |
159
|
|
|
$options['minDepth'], |
160
|
|
|
$options['maxDepth'], |
161
|
|
|
$options['escapeLabels'], |
162
|
|
|
$options['addClassToListItem'], |
163
|
|
|
$options['liActiveClass'] |
164
|
|
|
); |
165
|
|
|
} else { |
166
|
|
|
$html = $this->renderNormalMenu( |
167
|
|
|
$container, |
168
|
|
|
$options['ulClass'], |
169
|
|
|
$options['indent'], |
170
|
|
|
$options['minDepth'], |
171
|
|
|
$options['maxDepth'], |
172
|
|
|
$options['onlyActiveBranch'], |
173
|
|
|
$options['escapeLabels'], |
174
|
|
|
$options['addClassToListItem'], |
175
|
|
|
$options['liActiveClass'] |
176
|
|
|
); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
return $html; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Renders a normal menu (called from {@link renderMenu()}) |
184
|
|
|
* |
185
|
|
|
* @param AbstractContainer $container container to render |
186
|
|
|
* @param string $ulClass CSS class for first UL |
187
|
|
|
* @param string $indent initial indentation |
188
|
|
|
* @param int|null $minDepth minimum depth |
189
|
|
|
* @param int|null $maxDepth maximum depth |
190
|
|
|
* @param bool $onlyActive render only active branch? |
191
|
|
|
* @param bool $escapeLabels Whether or not to escape the labels |
192
|
|
|
* @param bool $addClassToListItem Whether or not page class applied to <li> element |
193
|
|
|
* @param string $liActiveClass CSS class for active LI |
194
|
|
|
* @return string |
195
|
|
|
*/ |
196
|
|
|
protected function renderNormalMenu( |
197
|
|
|
AbstractContainer $container, |
198
|
|
|
$ulClass, |
199
|
|
|
$indent, |
200
|
|
|
$minDepth, |
201
|
|
|
$maxDepth, |
202
|
|
|
$onlyActive, |
203
|
|
|
$escapeLabels, |
204
|
|
|
$addClassToListItem, |
205
|
|
|
$liActiveClass |
206
|
|
|
) { |
207
|
|
|
$html = ''; |
208
|
|
|
|
209
|
|
|
// find deepest active |
210
|
|
|
$found = $this->findActive($container, $minDepth, $maxDepth); |
211
|
|
|
/* @var $escaper \Zend\View\Helper\EscapeHtmlAttr */ |
212
|
|
|
$escaper = $this->view->plugin('escapeHtmlAttr'); |
|
|
|
|
213
|
|
|
|
214
|
|
|
if ($found) { |
215
|
|
|
$foundPage = $found['page']; |
216
|
|
|
$foundDepth = $found['depth']; |
217
|
|
|
} else { |
218
|
|
|
$foundPage = null; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
// create iterator |
222
|
|
|
$iterator = new RecursiveIteratorIterator( |
223
|
|
|
$container, |
224
|
|
|
RecursiveIteratorIterator::SELF_FIRST |
225
|
|
|
); |
226
|
|
|
if (is_int($maxDepth)) { |
227
|
|
|
$iterator->setMaxDepth($maxDepth); |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
// iterate container |
231
|
|
|
$prevDepth = -1; |
232
|
|
|
foreach ($iterator as $page) { |
233
|
|
|
$depth = $iterator->getDepth(); |
234
|
|
|
$page->set('level', $depth); |
235
|
|
|
$isActive = $page->isActive(true); |
236
|
|
|
if ($depth < $minDepth || !$this->accept($page)) { |
237
|
|
|
// page is below minDepth or not accepted by acl/visibility |
238
|
|
|
continue; |
239
|
|
|
} elseif ($onlyActive && !$isActive) { |
240
|
|
|
// page is not active itself, but might be in the active branch |
241
|
|
|
$accept = false; |
242
|
|
|
if ($foundPage) { |
243
|
|
|
if ($foundPage->hasPage($page)) { |
244
|
|
|
// accept if page is a direct child of the active page |
245
|
|
|
$accept = true; |
246
|
|
|
} elseif ($foundPage->getParent()->hasPage($page)) { |
247
|
|
|
// page is a sibling of the active page... |
248
|
|
|
if (!$foundPage->hasPages(!$this->renderInvisible) || |
249
|
|
|
is_int($maxDepth) && $foundDepth + 1 > $maxDepth) { |
|
|
|
|
250
|
|
|
// accept if active page has no children, or the |
251
|
|
|
// children are too deep to be rendered |
252
|
|
|
$accept = true; |
253
|
|
|
} |
254
|
|
|
} |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
if (!$accept) { |
258
|
|
|
continue; |
259
|
|
|
} |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
// make sure indentation is correct |
263
|
|
|
$depth -= $minDepth; |
264
|
|
|
$myIndent = $indent . str_repeat(' ', $depth); |
265
|
|
|
$attributes = $this->getAttributes(); |
266
|
|
|
if ($depth > $prevDepth) { |
267
|
|
|
// start new ul tag |
268
|
|
|
$ulClass = '' . |
269
|
|
|
($depth == 0 ? $this->getUlClass() : |
270
|
|
|
($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
271
|
|
|
) . |
272
|
|
|
' level_' . $depth . |
273
|
|
|
''; |
274
|
|
|
if ($ulClass && $depth == 0) { |
275
|
|
|
$ulClass = ' class="' . $escaper($ulClass) . '"'; |
276
|
|
|
} else { |
277
|
|
|
$ulClass = ' class="' . $escaper($ulClass) . '"'; |
278
|
|
|
} |
279
|
|
|
$html .= $myIndent . '<ul' . $ulClass . ' '.($depth == 0 ? $this->htmlAttribs($attributes) : '').'>' . PHP_EOL; |
280
|
|
|
} elseif ($prevDepth > $depth) { |
281
|
|
|
// close li/ul tags until we're at current depth |
282
|
|
|
for ($i = $prevDepth; $i > $depth; $i--) { |
283
|
|
|
$ind = $indent . str_repeat(' ', $i); |
284
|
|
|
$html .= $ind . ' </li>' . PHP_EOL; |
285
|
|
|
$html .= $ind . '</ul>' . PHP_EOL; |
286
|
|
|
} |
287
|
|
|
// close previous li tag |
288
|
|
|
$html .= $myIndent . ' </li>' . PHP_EOL; |
289
|
|
|
} else { |
290
|
|
|
// close previous li tag |
291
|
|
|
$html .= $myIndent . ' </li>' . PHP_EOL; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
// render li tag and page |
295
|
|
|
$liClasses = []; |
296
|
|
|
// Is page active? |
297
|
|
|
if ($isActive) { |
298
|
|
|
$liClasses[] = $liActiveClass; |
299
|
|
|
} |
300
|
|
|
if (!empty($this->getDefaultLiClass())) { |
301
|
|
|
$liClasses[] = $this->getDefaultLiClass(); |
302
|
|
|
} |
303
|
|
|
$isBelowMaxLevel = ($maxDepth > $depth) || ($maxDepth === null) || ($maxDepth === false); |
304
|
|
|
if (!empty($page->pages) && $isBelowMaxLevel) { |
305
|
|
|
$liClasses[] = ($depth == 0 ? $this->getSubLiClassLevel0() : $this->getSubLiClass()); |
306
|
|
|
} |
307
|
|
|
// Add CSS class from page to <li> |
308
|
|
|
if ($addClassToListItem && $page->getClass()) { |
309
|
|
|
$liClasses[] = $page->getClass(); |
310
|
|
|
} |
311
|
|
|
$liClass = empty($liClasses) ? '' : ' class="' . $escaper(implode(' ', $liClasses)) . '"'; |
312
|
|
|
|
313
|
|
|
$html .= $myIndent . ' <li' . $liClass . '>' . PHP_EOL |
314
|
|
|
. $myIndent . ' ' . $this->htmlify($page, $escapeLabels, $addClassToListItem) . PHP_EOL; |
315
|
|
|
|
316
|
|
|
// store as previous depth for next iteration |
317
|
|
|
$prevDepth = $depth; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
if ($html) { |
321
|
|
|
// done iterating container; close open ul/li tags |
322
|
|
|
for ($i = $prevDepth+1; $i > 0; $i--) { |
323
|
|
|
$myIndent = $indent . str_repeat(' ', $i-1); |
324
|
|
|
$html .= $myIndent . ' </li>' . PHP_EOL |
325
|
|
|
. $myIndent . '</ul>' . PHP_EOL; |
326
|
|
|
} |
327
|
|
|
$html = rtrim($html, PHP_EOL); |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
return $html; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* Finds the deepest active page in the given container |
335
|
|
|
* |
336
|
|
|
* @param Navigation\AbstractContainer $container container to search |
337
|
|
|
* @param int|null $minDepth [optional] minimum depth |
338
|
|
|
* required for page to be |
339
|
|
|
* valid. Default is to use |
340
|
|
|
* {@link getMinDepth()}. A |
341
|
|
|
* null value means no minimum |
342
|
|
|
* depth required. |
343
|
|
|
* @param int|null $maxDepth [optional] maximum depth |
344
|
|
|
* a page can have to be |
345
|
|
|
* valid. Default is to use |
346
|
|
|
* {@link getMaxDepth()}. A |
347
|
|
|
* null value means no maximum |
348
|
|
|
* depth required. |
349
|
|
|
* @return array an associative array with |
350
|
|
|
* the values 'depth' and |
351
|
|
|
* 'page', or an empty array |
352
|
|
|
* if not found |
353
|
|
|
*/ |
354
|
|
|
public function findActive($container = null, $minDepth = null, $maxDepth = -1) |
355
|
|
|
{ |
356
|
|
|
if ( null == $container ) { |
357
|
|
|
$container = $this->getContainer(); |
358
|
|
|
} |
359
|
|
|
return parent::findActive($container, $minDepth, $maxDepth); |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* Returns an HTML string containing an 'a' element for the given page if |
364
|
|
|
* the page's href is not empty, and a 'span' element if it is empty |
365
|
|
|
* |
366
|
|
|
* Overrides {@link AbstractHelper::htmlify()}. |
367
|
|
|
* |
368
|
|
|
* @param AbstractPage $page page to generate HTML for |
369
|
|
|
* @param bool $escapeLabel Whether or not to escape the label |
370
|
|
|
* @param bool $addClassToListItem Whether or not to add the page class to the list item |
371
|
|
|
* @return string |
372
|
|
|
*/ |
373
|
|
|
public function htmlify(AbstractPage $page, $escapeLabel = true, $addClassToListItem = false, $extraAttributes = [] ) |
374
|
|
|
{ |
375
|
|
|
$partial = $this->getHtmlifyPartial(); |
376
|
|
|
if ($partial) { |
377
|
|
|
return $this->renderHtmlifyPartial($page, $escapeLabel, $addClassToListItem, $partial); |
378
|
|
|
} |
379
|
|
|
// get attribs for element |
380
|
|
|
$attribs = array_merge([ |
381
|
|
|
'id' => $page->getId(), |
382
|
|
|
'title' => $this->translate($page->getTitle(), $page->getTextDomain()), |
383
|
|
|
'data-test' => 'cta-nav-' . $this->slugify($page->getLabel()), |
384
|
|
|
], $extraAttributes); |
385
|
|
|
|
386
|
|
|
$classnames = array(); |
387
|
|
|
if ( $addClassToListItem === false ) { |
388
|
|
|
$class = $page->getClass(); |
389
|
|
|
if (!empty($class)) { |
390
|
|
|
$classnames[] = $page->getClass(); |
391
|
|
|
} |
392
|
|
|
} |
393
|
|
|
$maxDepth = $this->getMaxDepth(); |
394
|
|
|
$depth = $page->get('level'); |
395
|
|
|
$isBelowMaxLevel = ($maxDepth > $depth) || ($maxDepth === null) || ($maxDepth === false); |
396
|
|
|
if ( !empty($page->pages) && $isBelowMaxLevel ) { |
397
|
|
|
$classnames[] = 'dropdown-toggle'; |
398
|
|
|
$attribs['data-toggle'] = (($depth == 0) ? $this->getSubLiClassLevel0() : $this->getSubLiClass()); |
399
|
|
|
} |
400
|
|
|
$attribs['class'] = implode(" ", $classnames); |
401
|
|
|
|
402
|
|
|
// does page have a href? |
403
|
|
|
$href = ( |
404
|
|
|
!empty($page->pages) && !empty($this->getHrefSubToggleOverride()) ? |
405
|
|
|
$this->getHrefSubToggleOverride() : $page->getHref() |
406
|
|
|
); |
407
|
|
|
$element = 'a'; |
408
|
|
|
if ($href) { |
409
|
|
|
$attribs['href'] = $href; |
410
|
|
|
$attribs['target'] = $page->getTarget(); |
411
|
|
|
} else { |
412
|
|
|
$attribs['href'] = '#'; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
$html = '<' . $element . $this->htmlAttribs($attribs) . '>'; |
416
|
|
|
$html .= ($page->get('icon') ? '<span class="' . $this->getIconPrefixClass() . '' . $page->get('icon') . '"></span> ' : '' ); |
417
|
|
|
$label = $this->translate($page->getLabel(), $page->getTextDomain()); |
418
|
|
|
if ($escapeLabel === true) { |
419
|
|
|
/** @var \Zend\View\Helper\EscapeHtml $escaper */ |
420
|
|
|
$escaper = $this->view->plugin('escapeHtml'); |
421
|
|
|
$html .= $escaper($label); |
422
|
|
|
} else { |
423
|
|
|
$html .= $label; |
424
|
|
|
} |
425
|
|
|
$html .= '</' . $element . '>'; |
426
|
|
|
|
427
|
|
|
return $html; |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* Renders the given $page by invoking the partial view helper |
432
|
|
|
* |
433
|
|
|
* The container will simply be passed on as a model to the view script |
434
|
|
|
* as-is, and will be available in the partial script as 'container', e.g. |
435
|
|
|
* <code>echo 'Number of pages: ', count($this->container);</code>. |
436
|
|
|
* |
437
|
|
|
* @param string|array $partial [optional] partial view script to use. |
438
|
|
|
* Default is to use the partial |
439
|
|
|
* registered in the helper. If an array |
440
|
|
|
* is given, it is expected to contain two |
441
|
|
|
* values; the partial view script to use, |
442
|
|
|
* and the module where the script can be |
443
|
|
|
* found. |
444
|
|
|
* @return string |
445
|
|
|
* @throws Exception\RuntimeException if no partial provided |
446
|
|
|
* @throws Exception\InvalidArgumentException if partial is invalid array |
447
|
|
|
*/ |
448
|
|
|
public function renderHtmlifyPartial(AbstractPage $page, $escapeLabel = true, $addClassToListItem = false, $partial = null) |
449
|
|
|
{ |
450
|
|
|
if (null === $partial) { |
451
|
|
|
$partial = $this->getPartial(); |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
if (empty($partial)) { |
455
|
|
|
throw new Exception\RuntimeException( |
|
|
|
|
456
|
|
|
'Unable to render menu: No partial view script provided' |
457
|
|
|
); |
458
|
|
|
} |
459
|
|
|
$model = [ |
460
|
|
|
'page' => $page, |
461
|
|
|
'escapeLabel' => $escapeLabel, |
462
|
|
|
'addClassToListItem' => $addClassToListItem, |
463
|
|
|
'menu' => (clone $this), |
464
|
|
|
|
465
|
|
|
]; |
466
|
|
|
|
467
|
|
|
/** @var \Zend\View\Helper\Partial $partialHelper */ |
468
|
|
|
$partialHelper = $this->view->plugin('partial'); |
469
|
|
|
|
470
|
|
|
if (is_array($partial)) { |
471
|
|
|
if (count($partial) != 2) { |
472
|
|
|
throw new Exception\InvalidArgumentException( |
|
|
|
|
473
|
|
|
'Unable to render menu: A view partial supplied as ' |
474
|
|
|
. 'an array must contain two values: partial view ' |
475
|
|
|
. 'script and module where script can be found' |
476
|
|
|
); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
return $partialHelper($partial[0], $model); |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
return $partialHelper($partial, $model); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* @return the $defaultLiClass |
|
|
|
|
487
|
|
|
*/ |
488
|
|
|
public function getDefaultLiClass() { |
489
|
|
|
return $this->defaultLiClass; |
|
|
|
|
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
/** |
493
|
|
|
* @param string $defaultLiClass |
494
|
|
|
*/ |
495
|
|
|
public function setDefaultLiClass($defaultLiClass) { |
496
|
|
|
$this->defaultLiClass = $defaultLiClass; |
497
|
|
|
return $this; |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
/** |
501
|
|
|
* @return the $subUlClass |
502
|
|
|
*/ |
503
|
|
|
public function getSubUlClass() { |
504
|
|
|
return $this->subUlClass; |
|
|
|
|
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* @param string $subUlClass |
509
|
|
|
*/ |
510
|
|
|
public function setSubUlClass($subUlClass) { |
511
|
|
|
$this->subUlClass = $subUlClass; |
512
|
|
|
return $this; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* @return the $subUlClassLevel1 |
517
|
|
|
*/ |
518
|
|
|
public function getSubUlClassLevel1() { |
519
|
|
|
return $this->subUlClassLevel1; |
|
|
|
|
520
|
|
|
} |
521
|
|
|
|
522
|
|
|
/** |
523
|
|
|
* @param string $subUlClassLevel1 |
524
|
|
|
*/ |
525
|
|
|
public function setSubUlClassLevel1($subUlClassLevel1) { |
526
|
|
|
$this->subUlClassLevel1 = $subUlClassLevel1; |
527
|
|
|
return $this; |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
/** |
531
|
|
|
* @return the $subLiClass |
532
|
|
|
*/ |
533
|
|
|
public function getSubLiClass() { |
534
|
|
|
return $this->subLiClass; |
|
|
|
|
535
|
|
|
} |
536
|
|
|
|
537
|
|
|
/** |
538
|
|
|
* @param string $subLiClass |
539
|
|
|
*/ |
540
|
|
|
public function setSubLiClass($subLiClass) { |
541
|
|
|
$this->subLiClass = $subLiClass; |
542
|
|
|
return $this; |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
/** |
546
|
|
|
* @return the $subLiClassLevel0 |
547
|
|
|
*/ |
548
|
|
|
public function getSubLiClassLevel0() { |
549
|
|
|
return $this->subLiClassLevel0; |
|
|
|
|
550
|
|
|
} |
551
|
|
|
|
552
|
|
|
/** |
553
|
|
|
* @param string $subLiClassLevel0 |
554
|
|
|
*/ |
555
|
|
|
public function setSubLiClassLevel0($subLiClassLevel0) { |
556
|
|
|
$this->subLiClassLevel0 = $subLiClassLevel0; |
557
|
|
|
return $this; |
558
|
|
|
} |
559
|
|
|
|
560
|
|
|
/** |
561
|
|
|
* @return the $iconPrefixClass |
562
|
|
|
*/ |
563
|
|
|
public function getIconPrefixClass() { |
564
|
|
|
return $this->iconPrefixClass; |
|
|
|
|
565
|
|
|
} |
566
|
|
|
|
567
|
|
|
/** |
568
|
|
|
* @param string $iconPrefixClass |
569
|
|
|
*/ |
570
|
|
|
public function setIconPrefixClass($iconPrefixClass) { |
571
|
|
|
$this->iconPrefixClass = $iconPrefixClass; |
572
|
|
|
return $this; |
573
|
|
|
} |
574
|
|
|
|
575
|
|
|
/** |
576
|
|
|
* @return the $hrefSubToggleOverride |
577
|
|
|
*/ |
578
|
|
|
public function getHrefSubToggleOverride() { |
579
|
|
|
return $this->hrefSubToggleOverride; |
|
|
|
|
580
|
|
|
} |
581
|
|
|
|
582
|
|
|
/** |
583
|
|
|
* @param string $hrefSubToggleOverride |
584
|
|
|
*/ |
585
|
|
|
public function setHrefSubToggleOverride($hrefSubToggleOverride) { |
586
|
|
|
$this->hrefSubToggleOverride = $hrefSubToggleOverride; |
587
|
|
|
return $this; |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
/** |
591
|
|
|
* Sets which partial view script to use for rendering menu |
592
|
|
|
* |
593
|
|
|
* @param string|array $partial partial view script or null. If an array is |
594
|
|
|
* given, it is expected to contain two |
595
|
|
|
* values; the partial view script to use, |
596
|
|
|
* and the module where the script can be |
597
|
|
|
* found. |
598
|
|
|
* @return self |
599
|
|
|
*/ |
600
|
|
|
public function setHtmlifyPartial($partial) |
601
|
|
|
{ |
602
|
|
|
if (null === $partial || is_string($partial) || is_array($partial)) { |
|
|
|
|
603
|
|
|
$this->htmlifyPartial = $partial; |
604
|
|
|
} |
605
|
|
|
|
606
|
|
|
return $this; |
607
|
|
|
} |
608
|
|
|
|
609
|
|
|
/** |
610
|
|
|
* Returns partial view script to use for rendering menu |
611
|
|
|
* |
612
|
|
|
* @return string|array|null |
613
|
|
|
*/ |
614
|
|
|
public function getHtmlifyPartial() |
615
|
|
|
{ |
616
|
|
|
return $this->htmlifyPartial; |
617
|
|
|
} |
618
|
|
|
|
619
|
|
|
/** |
620
|
|
|
* Translate a message (for label, title, …) |
621
|
|
|
* |
622
|
|
|
* @param string $message ID of the message to translate |
623
|
|
|
* @param string $textDomain Text domain (category name for the translations) |
624
|
|
|
* @return string Translated message |
625
|
|
|
*/ |
626
|
|
|
public function translate($message, $textDomain = null) |
627
|
|
|
{ |
628
|
|
|
return parent::translate($message, $textDomain); |
629
|
|
|
} |
630
|
|
|
|
631
|
|
|
|
632
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths