Elgg  Version master
register.php
Go to the documentation of this file.
1 <?php
6 $fields = [
7  [
8  '#type' => 'hidden',
9  'name' => 'friend_guid',
10  'value' => elgg_extract('friend_guid', $vars),
11  ],
12  [
13  '#type' => 'hidden',
14  'name' => 'invitecode',
15  'value' => elgg_extract('invitecode', $vars),
16  ],
17  [
18  '#type' => 'text',
19  '#label' => elgg_echo('name'),
20  '#class' => 'mtm',
21  'name' => 'name',
22  'value' => elgg_extract('name', $vars, get_input('n')),
23  'autofocus' => true,
24  'required' => true,
25  ],
26  [
27  '#type' => 'email',
28  '#label' => elgg_echo('email'),
29  'name' => 'email',
30  'value' => elgg_extract('email', $vars, get_input('e')),
31  'required' => true,
32  ],
33  [
34  '#type' => 'text',
35  '#label' => elgg_echo('username'),
36  'name' => 'username',
37  'value' => elgg_extract('username', $vars, get_input('u')),
38  'required' => true,
39  ],
40  [
41  '#type' => 'password',
42  '#label' => elgg_echo('password'),
43  'name' => 'password',
44  'required' => true,
45  'autocomplete' => 'new-password',
46  'add_security_requirements' => true,
47  ],
48  [
49  '#type' => 'password',
50  '#label' => elgg_echo('passwordagain'),
51  'name' => 'password2',
52  'required' => true,
53  'autocomplete' => 'new-password',
54  'add_security_requirements' => true,
55  ],
56 ];
57 
58 foreach ($fields as $field) {
59  echo elgg_view_field($field);
60 }
61 
62 // view to extend to add more fields to the registration form
63 echo elgg_view('register/extend', $vars);
64 
65 // Add captcha
66 echo elgg_view('input/captcha', $vars);
67 
69  '#type' => 'submit',
70  'text' => elgg_echo('register'),
71 ]);
72 
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
$fields
Elgg register form.
Definition: register.php:6
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
if(elgg_extract('input_type', $vars)) if(elgg_extract('required', $vars)) if(elgg_extract('disabled', $vars)) $field
Definition: field.php:42
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
elgg_set_form_footer(string $footer= '')
Sets form footer and defers its rendering until the form view and extensions have been rendered...
Definition: views.php:1046
$footer
Definition: register.php:68
$vars
Definition: theme.php:5