Elgg  Version 4.3
fieldset.php
Go to the documentation of this file.
1 <?php
17  'elgg-fieldset',
18  'clearfix',
19 ]);
20 
21 $align = elgg_extract('align', $vars, 'vertical');
22 unset($vars['align']);
23 $vars['class'][] = "elgg-fieldset-$align";
24 
25 $justify = elgg_extract('justify', $vars, '');
26 unset($vars['justify']);
27 if ($justify) {
28  $vars['class'][] = "elgg-justify-$justify";
29 }
30 
31 $legend = elgg_extract('legend', $vars);
32 unset($vars['legend']);
33 
34 $fields = (array) elgg_extract('fields', $vars, []);
35 unset($vars['fields']);
36 
37 $fieldset = '';
38 if ($legend) {
39  $vars['class'][] = 'elgg-fieldset-has-legend';
40  $fieldset .= elgg_format_element('legend', [], $legend);
41 }
42 
43 foreach ($fields as $field) {
44  $fieldset .= elgg_view_field($field);
45 }
46 
47 unset($vars['name']); // name isn't allowed on a DIV, but is commonly supplied to input views
48 
50 echo elgg_format_element('fieldset', [], $fieldset);
$fields
Definition: fieldset.php:34
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1143
$align
Definition: fieldset.php:21
if($justify) $legend
Definition: fieldset.php:31
$vars['class']
Renders a set of fields wrapped in a <fieldset> tag.
Definition: fieldset.php:16
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:569
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:135
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:547
if(elgg_extract('required', $vars)) if(elgg_extract('disabled', $vars)) $field
Definition: field.php:37
$fieldset
Definition: fieldset.php:37
elgg echo
Translates a string.
Definition: deprecated.js:530
$justify
Definition: fieldset.php:25