StartSubMenu and EndSubMenu events

This commit is contained in:
Mikael Nordfeldth 2015-02-14 17:32:35 +01:00
parent dc0b62f636
commit b6b9036821
2 changed files with 15 additions and 6 deletions

View File

@ -1472,3 +1472,12 @@ EndHomeStubNavItems:
- $action: action being executed (for output and params)
- $items: array of items in the nav
EndSubMenu: After outputting a submenu (including enclosing tags) to HTML
- $out: HTMLOutputter used to output (usually an Action, but not always!)
- $menu: The Menu object outputted as a submenu.
- $label: Localized text which represents the menu item.
StartSubMenu: Before outputting a submenu (including enclosing tags) to HTML
- $out: HTMLOutputter used to output (usually an Action, but not always!)
- $menu: The Menu object outputted as a submenu.
- $label: Localized text which represents the menu item.

View File

@ -150,12 +150,12 @@ class Menu extends Widget
function submenu($label, $menu)
{
if (empty($menu->getItems())){
return false;
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));
}
$this->action->elementStart('li');
$this->action->element('h3', null, $label);
$menu->show();
$this->action->elementEnd('li');
}
}