git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit b3ba7669 authored by Evan Prodromou's avatar Evan Prodromou

Add hooks for Start/End LoginGroupNav

parent 9e078c28
......@@ -122,3 +122,9 @@ StartAddressData: Allows the site owner to provide additional information about
EndAddressData: At the end of <address>
- $action: the current action
StartLoginGroupNav: Before showing the login and register navigation menu
- $action: the current action
EndLoginGroupNav: After showing the login and register navigation menu
- $action: the current action
......@@ -69,26 +69,30 @@ class LoginGroupNav extends Widget
function show()
{
// action => array('prompt', 'title')
$menu = array();
$action_name = $this->action->trimmed('action');
$this->action->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartLoginGroupNav', array(&$this->action))) {
$this->action->menuItem(common_local_url('login'),
_('Login'),
_('Login with a username and password'),
$action_name === 'login');
$menu['login'] = array(_('Login'),
_('Login with a username and password'));
if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
$menu['register'] = array(_('Register'),
_('Sign up for a new account'));
$this->action->menuItem(common_local_url('register'),
_('Register'),
_('Sign up for a new account'),
$action_name === 'register');
}
$menu['openidlogin'] = array(_('OpenID'),
_('Login or register with OpenID'));
$action_name = $this->action->trimmed('action');
$this->action->elementStart('ul', array('class' => 'nav'));
$this->action->menuItem(common_local_url('openidlogin'),
_('OpenID'),
_('Login or register with OpenID'),
$action_name === 'openidlogin');
foreach ($menu as $menuaction => $menudesc) {
$this->action->menuItem(common_local_url($menuaction),
$menudesc[0],
$menudesc[1],
$action_name === $menuaction);
Event::handle('EndLoginGroupNav', array(&$menu));
}
$this->action->elementEnd('ul');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment