Elgg  Version master
Login.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Menus;
4 
6 
13 class Login {
14 
22  public static function registerRegistration(\Elgg\Event $event) {
23 
24  if (!_elgg_services()->config->allow_registration || _elgg_services()->config->elgg_maintenance_mode) {
25  return;
26  }
27 
28  /* @var $return MenuItems */
29  $return = $event->getValue();
30 
31  $return[] = \ElggMenuItem::factory([
32  'name' => 'register',
33  'text' => elgg_echo('register'),
34  'href' => elgg_get_registration_url(),
35  'link_class' => 'registration_link',
36  ]);
37 
38  return $return;
39  }
40 
48  public static function registerResetPassword(\Elgg\Event $event) {
49 
50  if (_elgg_services()->config->elgg_maintenance_mode) {
51  return;
52  }
53 
54  /* @var $return MenuItems */
55  $return = $event->getValue();
56 
57  $return[] = \ElggMenuItem::factory([
58  'name' => 'forgotpassword',
59  'text' => elgg_echo('user:password:lost'),
60  'href' => elgg_generate_url('account:password:reset'),
61  'link_class' => 'forgot_link',
62  ]);
63 
64  return $return;
65  }
66 }
Register menu items to the login menu.
Definition: Login.php:13
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
static factory(array $options)
Create an ElggMenuItem from an associative array.
static registerRegistration(\Elgg\Event $event)
Add the registration menu item.
Definition: Login.php:22
elgg_get_registration_url(array $parameters=[], string $fragment= '')
Returns site&#39;s registration URL Triggers a &#39;registration_url&#39;, &#39;site&#39; event that can be used by plugi...
Definition: users.php:221
elgg_generate_url(string $name, array $parameters=[])
Generate a URL for named route.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
static registerResetPassword(\Elgg\Event $event)
Add the forgotten password menu item.
Definition: Login.php:48
Models an event passed to event handlers.
Definition: Event.php:11