Elgg  Version master
login_dropdown.php
Go to the documentation of this file.
1 <?php
6 if (elgg_is_logged_in()) {
7  return true;
8 }
9 
10 $body = elgg_view_form('login', [
11  'ajax' => true,
12 ], [
13  'returntoreferer' => true,
14 ]);
15 
16 $result = elgg_view('output/url', [
17  'href' => elgg_get_login_url([], '#login-dropdown-box'),
18  'class' => 'elgg-popup',
19  'text' => elgg_echo('login'),
20  'data-position' => json_encode([
21  'my' => 'right top',
22  'at' => 'right bottom',
23  ]),
24 ]);
25 
26 $result .= elgg_view_module('dropdown', '', $body, ['id' => 'login-dropdown-box']);
27 
28 echo elgg_format_element('div', ['id' => 'login-dropdown'], $result);
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:919
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
Definition: sessions.php:43
elgg_view_form(string $action, array $form_vars=[], array $body_vars=[])
Definition: views.php:1033
elgg_get_login_url(array $query=[], string $fragment= '')
Returns site&#39;s login URL Triggers a &#39;login_url&#39;, &#39;site&#39; event that can be used by plugins to alter th...
Definition: users.php:228
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
if(elgg_is_logged_in()) $body
Elgg drop-down login form.
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
$result
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145