summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries/Menu.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-02-26 09:58:57 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-02-26 09:58:57 -0800
commitf28b80fcf43e02ca65f419eb6774321dc30a2a37 (patch)
tree34d3e44e5716751f71d10de623228bd541b487ae /modules/gallery/libraries/Menu.php
parent9f810150532a2511bfc5f03c9d24fd592d2f803f (diff)
parentb4922f4d176662976c9d2b249edf0e50a0cdfdf1 (diff)
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/gallery/libraries/Menu.php')
-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) {