From fbefdd55564d2c14e0a4602784abcc51f0279edf Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 17 Jun 2009 06:14:36 -0700 Subject: 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 --- modules/gallery/libraries/Theme_View.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 31c2faa7..904a3c07 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -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"); } -- cgit v1.2.3