mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-01 20:50:38 -04:00
Fix for ticket #366
1) Stored the menu element type in the menu element 2) Scanned the menu before display removing any empty sub menus. Went with the removal approach because there will more users than developers Signed-off-by: <unostar@danalan.info>
This commit is contained in:
@@ -103,11 +103,25 @@ class Theme_View_Core extends View {
|
||||
call_user_func_array(array($class, "site"), array(&$menu, $this));
|
||||
}
|
||||
}
|
||||
|
||||
$this->_remove_empty_items($menu);
|
||||
}
|
||||
|
||||
print $menu;
|
||||
}
|
||||
|
||||
private function _remove_empty_items($menu) {
|
||||
foreach ($menu->elements as $target_id => $element) {
|
||||
if ($element->type == "submenu") {
|
||||
if (empty($element->elements)) {
|
||||
$menu->remove($target_id);
|
||||
} else {
|
||||
$this->_remove_empty_items($element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function album_menu() {
|
||||
$this->_menu("album");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user