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