mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-27 18:24:03 -04:00
Add Menu::add_after()
This commit is contained in:
@@ -129,6 +129,21 @@ class Menu_Core extends Menu_Element {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new element to this menu
|
||||
*/
|
||||
public function add_after($target_id, $new_menu_element) {
|
||||
$copy = array();
|
||||
foreach ($this->elements as $id => $menu_element) {
|
||||
$copy[$id] = $menu_element;
|
||||
if ($id == $target_id) {
|
||||
$copy[$target_id] = $new_menu_element;
|
||||
}
|
||||
}
|
||||
$this->elements = $copy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a Menu_Element by id
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user