From 08764fb4a86995ca279890f4ec0dcd0643ecb539 Mon Sep 17 00:00:00 2001 From: Grant Glendinning Date: Thu, 14 Jan 2021 12:36:15 +0000 Subject: [PATCH] Hidden Sub-menu item breaks menu structure If the last item in sub-menu has Display in Menu set to No, the entire menu structure breaks, with no menu items parsed after the menu_show!=1 is found. --- source/plg_system_t3/includes/menu/t3bootstrap.php | 13 +++++++++++-- .../plg_system_t3/includes/menu/t3bootstrap.tpl.php | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/source/plg_system_t3/includes/menu/t3bootstrap.php b/source/plg_system_t3/includes/menu/t3bootstrap.php index 48c74e6fb2..0721a5bd4e 100644 --- a/source/plg_system_t3/includes/menu/t3bootstrap.php +++ b/source/plg_system_t3/includes/menu/t3bootstrap.php @@ -43,9 +43,9 @@ function render() ob_start(); T3BootstrapTpl::render($this->getList()); $this->menu = ob_get_contents(); - ob_end_clean(); + ob_end_clean(); } - + return $this->menu; } @@ -59,11 +59,20 @@ function getList() // Get active menu item $items = $menu->getItems('menutype', $this->menutype); + $hidden_parents = array(); $lastitem = 0; if ($items) { foreach ($items as $i => $item) { + // Exclude item with menu item option 'Display in Menu' set to 'No' - #522 + if (($item->params->get('menu_show', 1) == 0) || in_array($item->parent_id, $hidden_parents)) + { + $hidden_parents[] = $item->id; + unset($items[$i]); + continue; + } + $item->deeper = false; $item->shallower = false; $item->level_diff = 0; diff --git a/source/plg_system_t3/includes/menu/t3bootstrap.tpl.php b/source/plg_system_t3/includes/menu/t3bootstrap.tpl.php index 4d9874bb0c..781133a2d6 100755 --- a/source/plg_system_t3/includes/menu/t3bootstrap.tpl.php +++ b/source/plg_system_t3/includes/menu/t3bootstrap.tpl.php @@ -24,10 +24,6 @@ static function render($list)