]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
StartSubMenu and EndSubMenu events
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 14 Feb 2015 16:32:35 +0000 (17:32 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 14 Feb 2015 16:32:35 +0000 (17:32 +0100)
EVENTS.txt
lib/menu.php

index b98c6ff52fda2a06e6b26ce9ae2a270a0a816c5b..9a6ddfd9a420f823836532ff66bbbcc7532553fb 100644 (file)
@@ -1472,3 +1472,12 @@ EndHomeStubNavItems:
 - $action: action being executed (for output and params)
 - $items: array of items in the nav
 
+EndSubMenu: After outputting a submenu (including enclosing tags) to HTML
+- $out:     HTMLOutputter used to output (usually an Action, but not always!)
+- $menu:    The Menu object outputted as a submenu.
+- $label:   Localized text which represents the menu item.
+
+StartSubMenu: Before outputting a submenu (including enclosing tags) to HTML
+- $out:     HTMLOutputter used to output (usually an Action, but not always!)
+- $menu:    The Menu object outputted as a submenu.
+- $label:   Localized text which represents the menu item.
index 4baeb70d2fba6f6667a36ddadf5d3655923bb32f..236e99263d0bc418b18cb063f56c7b7eed938196 100644 (file)
@@ -150,12 +150,12 @@ class Menu extends Widget
 
     function submenu($label, $menu)
     {
-        if (empty($menu->getItems())){
-            return false;
+        if (Event::handle('StartSubMenu', array($this->action, $menu, $label))) {
+            $this->action->elementStart('li');
+            $this->action->element('h3', null, $label);
+            $menu->show();
+            $this->action->elementEnd('li');
+            Event::handle('EndSubMenu', array($this->action, $menu, $label));
         }
-        $this->action->elementStart('li');
-        $this->action->element('h3', null, $label);
-        $menu->show();
-        $this->action->elementEnd('li');
     }
 }