]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/menu.php
Avoid having to check for notices without rendered copies in upgrade.php
[quix0rs-gnu-social.git] / lib / menu.php
index 4f671380e66475ec8fa371c9cc907ff2e79f8b34..236e99263d0bc418b18cb063f56c7b7eed938196 100644 (file)
@@ -56,7 +56,7 @@ class Menu extends Widget
      *
      * @param Action $action current action, used for output
      */
-    function __construct($action=null)
+    function __construct(Action $action=null)
     {
         parent::__construct($action);
 
@@ -104,7 +104,7 @@ class Menu extends Widget
         }
     }
     
-    function item($actionName, $args, $label, $description, $id=null)
+    function item($actionName, array $args, $label, $description, $id=null, $cls=null)
     {
         if (empty($id)) {
             $id = $this->menuItemID($actionName, $args);
@@ -116,10 +116,11 @@ class Menu extends Widget
                              $label,
                              $description,
                              $this->isCurrent($actionName, $args),
-                             $id);
+                             $id,
+                             $cls);
     }
 
-    function isCurrent($actionName, $args)
+    function isCurrent($actionName, array $args)
     {
         if ($actionName != $this->actionName) {
             return false;
@@ -143,13 +144,18 @@ class Menu extends Widget
                 $id .= '_' . $key . '_' . $value;
             }
         }
+
+        return $id;
     }
 
     function submenu($label, $menu)
     {
-        $this->action->elementStart('li');
-        $this->action->element('h3', null, $label);
-        $menu->show();
-        $this->action->elementEnd('li');
+        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));
+        }
     }
 }