]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add hooks for Start/End LoginGroupNav
authorEvan Prodromou <evan@controlyourself.ca>
Tue, 4 Aug 2009 10:52:57 +0000 (06:52 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Tue, 4 Aug 2009 10:52:57 +0000 (06:52 -0400)
EVENTS.txt
lib/logingroupnav.php

index 2c43469d4642c3e8a9edc5f1bd5f6da2fd33831c..d07c31f8dc5125eb3ed587d5526bfb0364006a05 100644 (file)
@@ -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
index f23985f3ab3a1293bcb02a8ab98364b355628a81..538643d7e0d02b53c8c59993490d6ba5f2a4ef26 100644 (file)
@@ -69,26 +69,30 @@ class LoginGroupNav extends Widget
 
     function show()
     {
-        // action => array('prompt', 'title')
-        $menu = array();
-
-        $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'));
-        }
-        $menu['openidlogin'] = array(_('OpenID'),
-                               _('Login or register with OpenID'));
-
         $action_name = $this->action->trimmed('action');
+
         $this->action->elementStart('ul', array('class' => 'nav'));
 
-        foreach ($menu as $menuaction => $menudesc) {
-            $this->action->menuItem(common_local_url($menuaction),
-                                    $menudesc[0],
-                                    $menudesc[1],
-                                    $action_name === $menuaction);
+        if (Event::handle('StartLoginGroupNav', array(&$this->action))) {
+
+            $this->action->menuItem(common_local_url('login'),
+                                    _('Login'),
+                                    _('Login with a username and password'),
+                                    $action_name === 'login');
+
+            if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
+                $this->action->menuItem(common_local_url('register'),
+                                        _('Register'),
+                                        _('Sign up for a new account'),
+                                        $action_name === 'register');
+            }
+
+            $this->action->menuItem(common_local_url('openidlogin'),
+                                    _('OpenID'),
+                                    _('Login or register with OpenID'),
+                                    $action_name === 'openidlogin');
+
+            Event::handle('EndLoginGroupNav', array(&$menu));
         }
 
         $this->action->elementEnd('ul');