]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
a hook for showing the default local nav
authorEvan Prodromou <evan@status.net>
Tue, 5 Apr 2011 22:07:10 +0000 (18:07 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 5 Apr 2011 22:15:47 +0000 (18:15 -0400)
EVENTS.txt
lib/defaultlocalnav.php

index 1494a9c8904361852a16c28d816859710ca98213..b328785e7b07aac9ad884b925336e543f1645e8d 100644 (file)
@@ -1139,3 +1139,11 @@ StartNoticeWhoGets: Called at start of inbox delivery prep; plugins can schedule
 EndNoticeWhoGets: Called at end of inbox delivery prep; plugins can filter out profiles from receiving inbox delivery here.  Be aware that output can be cached or used several times, so should remain idempotent.
 - $notice Notice
 - &$ni: in/out array mapping profile IDs to constants: NOTICE_INBOX_SOURCE_SUB etc
+
+StartDefaultLocalNav: When showing the default local nav
+- $menu: the menu
+- $user: current user
+
+EndDefaultLocalNav: When showing the default local nav
+- $menu: the menu
+- $user: current user
index a61ebbb585fbc8373767ec82cb34a056c0ce889d..1201ae746829814fa3011710176a5a5f1c4d62ec 100644 (file)
@@ -48,25 +48,30 @@ class DefaultLocalNav extends Menu
 {
     function show()
     {
+        $user = common_current_user();
+
         $this->action->elementStart('ul', array('id' => 'nav_local_default'));
 
-        $user = common_current_user();
+        if (Event::handle('StartDefaultLocalNav', array($this, $user))) {
 
-        if (!empty($user)) {
-            $pn = new PersonalGroupNav($this->action);
-            // TRANS: Menu item in default local navigation panel.
-            $this->submenu(_m('MENU','Home'), $pn);
-        }
+            if (!empty($user)) {
+                $pn = new PersonalGroupNav($this->action);
+                // TRANS: Menu item in default local navigation panel.
+                $this->submenu(_m('MENU','Home'), $pn);
+            }
 
-        $bn = new PublicGroupNav($this->action);
-        // TRANS: Menu item in default local navigation panel.
-        $this->submenu(_m('MENU','Public'), $bn);
+            $bn = new PublicGroupNav($this->action);
+            // TRANS: Menu item in default local navigation panel.
+            $this->submenu(_m('MENU','Public'), $bn);
 
-        if (!empty($user)) {
-            $sn = new GroupsNav($this->action, $user);
-            if ($sn->haveGroups()) {
-                $this->submenu(_m('MENU', 'Groups'), $sn);
+            if (!empty($user)) {
+                $sn = new GroupsNav($this->action, $user);
+                if ($sn->haveGroups()) {
+                    $this->submenu(_m('MENU', 'Groups'), $sn);
+                }
             }
+
+            Event::handle('EndDefaultLocalNav', array($this, $user));
         }
 
         $this->action->elementEnd('ul');