]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge commit 'refs/merge-requests/45' of https://gitorious.org/social/mainline into...
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 14 Feb 2015 15:45:04 +0000 (16:45 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 14 Feb 2015 15:45:04 +0000 (16:45 +0100)
EVENTS.txt
lib/adminpanelnav.php
lib/homestubnav.php
lib/menu.php

index 8f094d16434a3b86e270806e758ce769e68f2b33..b98c6ff52fda2a06e6b26ce9ae2a270a0a816c5b 100644 (file)
@@ -1463,3 +1463,12 @@ StartNotifyMentioned: During notice distribution, we send notifications (email,
 EndNotifyMentioned: During notice distribution, we send notifications (email, im...) to the profiles who were somehow mentioned.
 - $stored:         Notice object that is being distributed.
 - $mentioned_ids:  Array of profile IDs (not just for local users) who got mentioned by the notice.
+
+StartHomeStubNavItems: Go back Home nav items. Default includes just one item 'home'
+- $action: action being executed (for output and params)
+- $items: array of items in the nav
+
+EndHomeStubNavItems:
+- $action: action being executed (for output and params)
+- $items: array of items in the nav
+
index 93a4d36ebbe6c673953ed73e45b5676af54a7f9e..9044749181d3e8b94c31317eedde537e4a139aa5 100644 (file)
@@ -59,24 +59,8 @@ class AdminPanelNav extends Menu
         $nickname = $user->nickname;
         $name = $user->getProfile()->getBestName();
 
-        // Stub section w/ home link
-        $this->action->elementStart('ul');
-        $this->action->elementStart('li');
-        // TRANS: Header in administrator navigation panel.
-        $this->action->element('h3', null, _m('HEADER','Home'));
-        $this->action->elementStart('ul', 'nav');
-        $this->out->menuItem(common_local_url('all', array('nickname' =>
-                                                           $nickname)),
-                             // TRANS: Menu item in administrator navigation panel.
-                             _m('MENU','Home'),
-                             // TRANS: Menu item title in administrator navigation panel.
-                             // TRANS: %s is a username.
-                             sprintf(_('%s and friends'), $name),
-                             $this->action == 'all', 'nav_timeline_personal');
-
-        $this->action->elementEnd('ul');
-        $this->action->elementEnd('li');
-        $this->action->elementEnd('ul');
+        $stub = new HomeStubNav($this->action);
+        $this->submenu(_m('MENU','Home'), $stub);
 
         $this->action->elementStart('ul');
         $this->action->elementStart('li');
index 7dd6ae19a1a1d703af160a6efc1e1032be90e5b0..64212f18aaf3c596d8cbe0dd63b21b719361cb3b 100644 (file)
@@ -49,13 +49,18 @@ class HomeStubNav extends Menu
 {
     function getItems()
     {
-        return array(array('top',
-                           array(),
-                           // TRANS: Menu item in personal group navigation menu.
-                           _m('MENU','Home'),
-                           // TRANS: Menu item title in personal group navigation menu.
-                           // TRANS: %s is a username.
-                           _('Back to top'),
-                           'nav_return_top'));
+        $items = array();
+        if (Event::handle('StartHomeStubNavItems', array($this->action, &$items))) {
+            $items[] = array('top',
+                            array(),
+                            // TRANS: Menu item in personal group navigation menu.
+                            _m('MENU','Home'),
+                            // TRANS: Menu item title in personal group navigation menu.
+                            // TRANS: %s is a username.
+                            _('Back to top'),
+                            'nav_return_top');
+            Event::handle('EndHomeStubNavItems', array($this->action, &$items));
+        }
+        return $items;
     }
 }
index 27503aa06bf59d4e48dc67e1dd57909342031680..4baeb70d2fba6f6667a36ddadf5d3655923bb32f 100644 (file)
@@ -150,6 +150,9 @@ class Menu extends Widget
 
     function submenu($label, $menu)
     {
+        if (empty($menu->getItems())){
+            return false;
+        }
         $this->action->elementStart('li');
         $this->action->element('h3', null, $label);
         $menu->show();