Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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:290
$defaults
Definition: form.php:18
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:218
$body
Definition: form.php:31
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310
$vars
Definition: form.php:23