Skip to content

Hidden sub-menue item breaks menu-structur #522

@HoozeMe

Description

@HoozeMe

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:

if ($menu_show!=1) {
	// ** ... Hack fixing the problem of a last item that is hidden 
	if ($item->shallower) 
		echo str_repeat('</ul></li>', $item->level_diff);
	// ***
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.

if($item->deeper && $item->level < 2 && strpos($item->note, 'NODEEP') === false ){
	$class    .= ' dropdown-toggle';
	$dropdown  = ' data-toggle="dropdown"';
	$caret     = '<em class="caret"></em>';
}

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions