diff options
Diffstat (limited to 'modules/gallery/libraries/Menu.php')
-rw-r--r-- | modules/gallery/libraries/Menu.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 79274057..6d0881ce 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -146,6 +146,18 @@ class Menu_Core extends Menu_Element { } } + public function compact() { + foreach ($this->elements as $target_id => $element) { + if ($element->type == "submenu") { + if (empty($element->elements)) { + $this->remove($target_id); + } else { + $element->compact(); + } + } + } + } + public function __construct($type) { parent::__construct($type); $this->elements = array(); |