diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-17 06:14:36 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-17 06:14:36 -0700 |
commit | fbefdd55564d2c14e0a4602784abcc51f0279edf (patch) | |
tree | bd396b56064d5945121551ad4803de9023fa5f21 /modules/gallery/libraries/Menu.php | |
parent | 2531f679902e5e4bc5237017debb468c722d6b15 (diff) |
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
Diffstat (limited to 'modules/gallery/libraries/Menu.php')
-rw-r--r-- | modules/gallery/libraries/Menu.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 83bd1616..79274057 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -23,6 +23,11 @@ class Menu_Element { public $css_id; public $css_class; public $id; + public $type; + + public function __construct($type) { + $this->type = $type; + } /** * Set the id @@ -125,26 +130,26 @@ class Menu_Core extends Menu_Element { public static function factory($type) { switch($type) { case "link": - return new Menu_Element_Link(); + return new Menu_Element_Link($type); case "dialog": - return new Menu_Element_Dialog(); + return new Menu_Element_Dialog($type); case "root": - $menu = new Menu(); - $menu->is_root = true; - return $menu; + return new Menu("root"); case "submenu": - return new Menu(); + return new Menu("submenu"); default: throw Exception("@todo UNKNOWN_MENU_TYPE"); } } - public function __construct() { + public function __construct($type) { + parent::__construct($type); $this->elements = array(); + $this->is_root = $type == "root"; } /** |