From e834c4ca2434ff687461e39ee02926f449f49287 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 2 Jun 2009 15:46:05 -0700 Subject: Have server_add turn the "Add Photo" menu option into a dropdown and make "Add from Server" a 2nd option there. This requires adding the Menu::remove() API function. --- modules/gallery/libraries/Menu.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'modules/gallery/libraries/Menu.php') diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index d19d8b1e..83bd1616 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -170,11 +170,22 @@ class Menu_Core extends Menu_Element { return $this; } + /** + * Remove an element from the menu + */ + public function remove($target_id) { + unset($this->elements[$target_id]); + } + /** * Retrieve a Menu_Element by id */ public function get($id) { - return $this->elements[$id]; + if (array_key_exists($id, $this->elements)) { + return $this->elements[$id]; + } + + return null; } public function __toString() { -- cgit v1.2.3