Elgg  Version 3.0
field.php
Go to the documentation of this file.
1 <?php
14 if (!$value) {
15  return;
16 }
17 
18 $icon = elgg_extract('icon', $vars, '');
19 if ($icon && !preg_match('/^</', $icon)) {
21 }
22 
23 if ($icon) {
24  $icon = elgg_format_element('span', [
25  'class' => 'elgg-profile-field-icon',
26  ], $icon);
27 }
28 
29 $label = elgg_extract('label', $vars, '');
30 $label = elgg_format_element('span', [
31  'class' => 'elgg-profile-field-label',
32 ], $label);
33 
34 $class = ['elgg-profile-field'];
35 
36 $align = elgg_extract('align', $vars, 'vertical');
37 $class[] = "elgg-profile-field-$align";
38 
40 
42  'class' => $class,
43  'data-name' => elgg_extract('name', $vars),
44 ], $icon . $label . $value);
if($view &&elgg_view_exists($view)) $label
Definition: field.php:26
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
$class
Definition: field.php:29
if(!$value) $icon
Definition: field.php:18
$value
Outputs a field with a label.
Definition: field.php:13
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
$align
Definition: field.php:36
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
elgg_view_icon($name, $vars=[])
View an icon glyph.
Definition: views.php:1552
$vars['type']
Definition: save.php:11