From 72c6dfd47f23aecbf5e3e89f12bad6a90437d39b Mon Sep 17 00:00:00 2001 From: Tarcisio Cesar <tarcisiocms@outlook.com> Date: Tue, 23 Jan 2024 19:53:33 -0300 Subject: [PATCH 1/4] 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> --- src/Helper/Navigation/Menu.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Helper/Navigation/Menu.php b/src/Helper/Navigation/Menu.php index f3744ab51..67e5b252c 100644 --- a/src/Helper/Navigation/Menu.php +++ b/src/Helper/Navigation/Menu.php @@ -269,20 +269,21 @@ protected function renderNormalMenu( $liActiveClass ) { $html = ''; - - // find deepest active - $found = $this->findActive($container, $minDepth, $maxDepth); - + $escaper = $this->view->plugin('escapeHtmlAttr'); assert($escaper instanceof EscapeHtmlAttr); $foundPage = null; $foundDepth = 0; - - if ($found) { - $foundPage = $found['page']; - $foundDepth = $found['depth']; - } + + if ($onlyActive) { + // find deepest active + $found = $this->findActive($container, $minDepth, $maxDepth); + if ($found) { + $foundPage = $found['page']; + $foundDepth = $found['depth']; + } + } // create iterator $iterator = new RecursiveIteratorIterator( From 0dcaec4811a792053b37fd0c3e47760316ccaab1 Mon Sep 17 00:00:00 2001 From: Tarcisio Cesar <tarcisiocms@outlook.com> Date: Tue, 23 Jan 2024 20:34:55 -0300 Subject: [PATCH 2/4] Update Menu.php Correcting indentation Signed-off-by: Tarcisio Cesar <tarcisiocms@outlook.com> --- src/Helper/Navigation/Menu.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Helper/Navigation/Menu.php b/src/Helper/Navigation/Menu.php index 67e5b252c..98980cd19 100644 --- a/src/Helper/Navigation/Menu.php +++ b/src/Helper/Navigation/Menu.php @@ -269,21 +269,21 @@ protected function renderNormalMenu( $liActiveClass ) { $html = ''; - + $escaper = $this->view->plugin('escapeHtmlAttr'); assert($escaper instanceof EscapeHtmlAttr); $foundPage = null; $foundDepth = 0; - + if ($onlyActive) { - // find deepest active - $found = $this->findActive($container, $minDepth, $maxDepth); - if ($found) { - $foundPage = $found['page']; - $foundDepth = $found['depth']; - } - } + // find deepest active + $found = $this->findActive($container, $minDepth, $maxDepth); + if ($found) { + $foundPage = $found['page']; + foundDepth = $found['depth']; + } + } // create iterator $iterator = new RecursiveIteratorIterator( From 461b9f84b3bef8fa349229406a7e7394aa648592 Mon Sep 17 00:00:00 2001 From: Tarcisio Cesar <tarcisiocms@outlook.com> Date: Tue, 23 Jan 2024 20:39:49 -0300 Subject: [PATCH 3/4] Update Menu.php Signed-off-by: Tarcisio Cesar <tarcisiocms@outlook.com> --- src/Helper/Navigation/Menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helper/Navigation/Menu.php b/src/Helper/Navigation/Menu.php index 98980cd19..ec9e42b5b 100644 --- a/src/Helper/Navigation/Menu.php +++ b/src/Helper/Navigation/Menu.php @@ -281,7 +281,7 @@ protected function renderNormalMenu( $found = $this->findActive($container, $minDepth, $maxDepth); if ($found) { $foundPage = $found['page']; - foundDepth = $found['depth']; + $foundDepth = $found['depth']; } } From 4db82a7c72d64d6def4820ac71a608d31cfa9c9f Mon Sep 17 00:00:00 2001 From: Tarcisio Cesar <tarcisiocms@outlook.com> Date: Tue, 23 Jan 2024 20:47:05 -0300 Subject: [PATCH 4/4] Update Menu.php Signed-off-by: Tarcisio Cesar <tarcisiocms@outlook.com> --- src/Helper/Navigation/Menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helper/Navigation/Menu.php b/src/Helper/Navigation/Menu.php index ec9e42b5b..63199b69c 100644 --- a/src/Helper/Navigation/Menu.php +++ b/src/Helper/Navigation/Menu.php @@ -280,7 +280,7 @@ protected function renderNormalMenu( // find deepest active $found = $this->findActive($container, $minDepth, $maxDepth); if ($found) { - $foundPage = $found['page']; + $foundPage = $found['page']; $foundDepth = $found['depth']; } }