Skip to content

Commit 72c6dfd

Browse files
authored
Update Menu.php
The consumption of the findActive function may be conditioned on the $onlyActive variable since the use of the $foundPage and $foundDepth variables within foreach is also Signed-off-by: Tarcisio Cesar <tarcisiocms@outlook.com>
1 parent e53ec5c commit 72c6dfd

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Helper/Navigation/Menu.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,21 @@ protected function renderNormalMenu(
269269
$liActiveClass
270270
) {
271271
$html = '';
272-
273-
// find deepest active
274-
$found = $this->findActive($container, $minDepth, $maxDepth);
275-
272+
276273
$escaper = $this->view->plugin('escapeHtmlAttr');
277274
assert($escaper instanceof EscapeHtmlAttr);
278275

279276
$foundPage = null;
280277
$foundDepth = 0;
281-
282-
if ($found) {
283-
$foundPage = $found['page'];
284-
$foundDepth = $found['depth'];
285-
}
278+
279+
if ($onlyActive) {
280+
// find deepest active
281+
$found = $this->findActive($container, $minDepth, $maxDepth);
282+
if ($found) {
283+
$foundPage = $found['page'];
284+
$foundDepth = $found['depth'];
285+
}
286+
}
286287

287288
// create iterator
288289
$iterator = new RecursiveIteratorIterator(

0 commit comments

Comments
 (0)