Open HoozeMe opened 6 years ago
Sorry for late answer ... today an update of T3 reminded me of that bug. I try to prepare an environment with that problem - but I had to fix it on our live-website immediately.
Here some screenshots...
This is the menu configuration:
'Kinder', 'Music' are 1st level entries; but because of the hidden entry they are put below the 'Gemeinde'-Entry
So it looks with original code:
So it looks with my hack: Almost okay :)
This issue still exists. Hack fix as above works, but not really a solution.
Hi, Just spent hours trying to work out why my menu was suddenly broken after turning off MegaMenu which seems to hide the bug.
They have added:
//intergration with new params joomla 3.6.x (menu_show)
$menu_show = (int)$item->params->get('menu_show', 1);
if ($menu_show!=1)
continue;
to T3BootstrapTpl::render() but this is the wrong place for this code - by now the array of menu items should just be rendered. If you compare the code with how the core ModMenuHelper::getList() works the array of menu items should already have excluded the hidden menu item before passing it to the render function. The code above should be removed from T3BootstrapTpl::render() and instead the correct code mirroring how ModMenuHelper::getList() works should be added to T3Bootstrap::getList()
Here is the git patch for the file in our site: T3Bootstrap-fix-hidden-sub-menu-item-bug.patch.txt
It adds the $hidden_parents array:
// Get active menu item
$items = $menu->getItems('menutype', $this->menutype);
$hidden_parents = array(); // Bug fix for issue 522
$lastitem = 0;
plus adds exactly the same menu_show check as the core file before the $item->parent = ... line :
// Exclude item with menu item option set to exclude from menu modules - Bug fix for issue 522
if (($item->params->get('menu_show', 1) == 0) || in_array($item->parent_id, $hidden_parents))
{
$hidden_parents[] = $item->id;
unset($items[$i]);
continue;
}
This fixes the broken menu html for our site.
If the last submenu item is set to 'hidden' (not shown), the ul/li - stuctur is broken Threfore I added the closing statment before continue:
Now ist works, but ... ... if there is only one sub-item and this is hidden, the 'caret' is still shown.
To fix this 'quick and dirty' I compare in the type-functions a small hint from the menu-item-note.
My changes work ;) ... but only until the next update.
I propose a recursive buildup of the menu instead of the linear one in the function render($list). Then you know exactly whether an item is displayed and whether whole submenus may be empty and no dropdowns are to be displayed (not use $item->deeper, this could be hidden).