summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2010-02-22 00:00:25 -0800
committerAndy Staudacher <andy.st@gmail.com>2010-02-22 00:00:25 -0800
commit95374070db74362bc1481e3fdcdab0d89678c1bc (patch)
treeb8bcb4324ceecc9abf0f2fbfb16a0ec7f364dcd2 /modules
parentff9129c59850277c3079edd19b8a0f7ac4d70056 (diff)
parent9b7542b9f1beb96f16123beebdd13728783f6dcd (diff)
Merge commit 'upstream/master'
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/libraries/Menu.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php
index 7c76ab04..fef07916 100644
--- a/modules/gallery/libraries/Menu.php
+++ b/modules/gallery/libraries/Menu.php
@@ -184,7 +184,7 @@ class Menu_Core extends Menu_Element {
}
/**
- * Add a new element to this menu
+ * Add a new element to this menu, after the specific element
*/
public function add_after($target_id, $new_menu_element) {
$copy = array();
@@ -199,6 +199,21 @@ class Menu_Core extends Menu_Element {
}
/**
+ * Add a new element to this menu, before the specific element
+ */
+ public function add_before($target_id, $new_menu_element) {
+ $copy = array();
+ foreach ($this->elements as $id => $menu_element) {
+ if ($id == $target_id) {
+ $copy[$new_menu_element->id] = $new_menu_element;
+ }
+ $copy[$id] = $menu_element;
+ }
+ $this->elements = $copy;
+ return $this;
+ }
+
+ /**
* Remove an element from the menu
*/
public function remove($target_id) {