a hook for showing the default local nav

This commit is contained in:
Evan Prodromou 2011-04-05 18:07:10 -04:00
parent a36fa8364a
commit 2138c3b339
2 changed files with 27 additions and 14 deletions

View 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. 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 - $notice Notice
- &$ni: in/out array mapping profile IDs to constants: NOTICE_INBOX_SOURCE_SUB etc - &$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

View File

@ -48,25 +48,30 @@ class DefaultLocalNav extends Menu
{ {
function show() function show()
{ {
$this->action->elementStart('ul', array('id' => 'nav_local_default'));
$user = common_current_user(); $user = common_current_user();
if (!empty($user)) { $this->action->elementStart('ul', array('id' => 'nav_local_default'));
$pn = new PersonalGroupNav($this->action);
// TRANS: Menu item in default local navigation panel.
$this->submenu(_m('MENU','Home'), $pn);
}
$bn = new PublicGroupNav($this->action); if (Event::handle('StartDefaultLocalNav', array($this, $user))) {
// TRANS: Menu item in default local navigation panel.
$this->submenu(_m('MENU','Public'), $bn);
if (!empty($user)) { if (!empty($user)) {
$sn = new GroupsNav($this->action, $user); $pn = new PersonalGroupNav($this->action);
if ($sn->haveGroups()) { // TRANS: Menu item in default local navigation panel.
$this->submenu(_m('MENU', 'Groups'), $sn); $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);
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'); $this->action->elementEnd('ul');