Elgg  Version 1.11
form.php
Go to the documentation of this file.
1 <?php
18 $defaults = array(
19  'method' => 'post',
20  'disable_security' => FALSE,
21 );
22 
23 $vars = array_merge($defaults, $vars);
24 
25 $vars['class'] = (array) elgg_extract('class', $vars, []);
26 $vars['class'][] = 'elgg-form';
27 
28 $vars['action'] = elgg_normalize_url($vars['action']);
29 $vars['method'] = strtolower($vars['method']);
30 
31 $body = $vars['body'];
32 unset($vars['body']);
33 
34 // Generate a security header
35 if (!$vars['disable_security']) {
36  $body = elgg_view('input/securitytoken') . $body;
37 }
38 unset($vars['disable_security']);
39 unset($vars['action_name']);
40 
41 echo elgg_format_element('form', $vars, "<fieldset>$body</fieldset>");
elgg_normalize_url($url)
Definition: output.php:311
$defaults
Definition: form.php:18
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:215
$body
Definition: form.php:31
elgg echo
Translates a string.
Definition: languages.js:43
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
$vars
Definition: form.php:23