forked from GNUsocial/gnu-social
		
	Removing home stub if empty
Added an Event HomeStubNavItems menu->subMenu() returns false if empty
This commit is contained in:
		@@ -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.
 | 
					EndNotifyMentioned: During notice distribution, we send notifications (email, im...) to the profiles who were somehow mentioned.
 | 
				
			||||||
- $stored:         Notice object that is being distributed.
 | 
					- $stored:         Notice object that is being distributed.
 | 
				
			||||||
- $mentioned_ids:  Array of profile IDs (not just for local users) who got mentioned by the notice.
 | 
					- $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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,17 +49,18 @@ class HomeStubNav extends Menu
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    function getItems()
 | 
					    function getItems()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (Event::handle('StartHomeStubNav', array(&$this->action))) {
 | 
					        $items = array();
 | 
				
			||||||
            return array(array('top',
 | 
					        if (Event::handle('StartHomeStubNavItems', array($this->action, &$items))) {
 | 
				
			||||||
 | 
					            $items[] = array('top',
 | 
				
			||||||
                            array(),
 | 
					                            array(),
 | 
				
			||||||
                            // TRANS: Menu item in personal group navigation menu.
 | 
					                            // TRANS: Menu item in personal group navigation menu.
 | 
				
			||||||
                            _m('MENU','Home'),
 | 
					                            _m('MENU','Home'),
 | 
				
			||||||
                            // TRANS: Menu item title in personal group navigation menu.
 | 
					                            // TRANS: Menu item title in personal group navigation menu.
 | 
				
			||||||
                            // TRANS: %s is a username.
 | 
					                            // TRANS: %s is a username.
 | 
				
			||||||
                            _('Back to top'),
 | 
					                            _('Back to top'),
 | 
				
			||||||
                               'nav_return_top'));
 | 
					                            'nav_return_top');
 | 
				
			||||||
            Event::handle('EndHomeStubNav', array(&$this->action));
 | 
					            Event::handle('EndHomeStubNavItems', array($this->action, &$items));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return Null;
 | 
					        return $items;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,8 +150,9 @@ class Menu extends Widget
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function submenu($label, $menu)
 | 
					    function submenu($label, $menu)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if(!$menu->getItems())
 | 
					        if (empty($menu->getItems())){
 | 
				
			||||||
            return;
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        $this->action->elementStart('li');
 | 
					        $this->action->elementStart('li');
 | 
				
			||||||
        $this->action->element('h3', null, $label);
 | 
					        $this->action->element('h3', null, $label);
 | 
				
			||||||
        $menu->show();
 | 
					        $menu->show();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user