From a6a9b256ae7ac686ed1f53c05275ae702fb37aad Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 17 Jun 2009 13:34:18 -0700 Subject: Correct the "inappropriate intimacy" smell that bharat's refined senses pick up --- modules/gallery/libraries/Menu.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules/gallery/libraries/Menu.php') 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(); -- cgit v1.2.3