From 2a0a0287d47bd51eef6d3369ca74c7f673e72b39 Mon Sep 17 00:00:00 2001 From: buttle Date: Tue, 10 Feb 2015 19:20:01 +0100 Subject: [PATCH] Added EVENT to homestubnav Changed menu->submenu(). if (! $menu->getItems()) then do nothing --- lib/homestubnav.php | 20 ++++++++++++-------- lib/menu.php | 2 ++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/homestubnav.php b/lib/homestubnav.php index 7dd6ae19a1..d22d1fd16c 100644 --- a/lib/homestubnav.php +++ b/lib/homestubnav.php @@ -49,13 +49,17 @@ 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')); + if (Event::handle('StartHomeStubNav', array(&$this->action))) { + 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')); + Event::handle('EndHomeStubNav', array(&$this->action)); + } + return Null; } } diff --git a/lib/menu.php b/lib/menu.php index 27503aa06b..3d22ff4924 100644 --- a/lib/menu.php +++ b/lib/menu.php @@ -150,6 +150,8 @@ class Menu extends Widget function submenu($label, $menu) { + if(!$menu->getItems()) + return; $this->action->elementStart('li'); $this->action->element('h3', null, $label); $menu->show(); -- 2.39.5