Elgg  Version master
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 && !str_starts_with($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 
41 echo elgg_format_element('div', [
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($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
$class
Definition: field.php:29
if(!$value) $icon
Definition: field.php:18
$value
Outputs a field with a label.
Definition: field.php:13
$align
Definition: field.php:36
elgg_view_icon(string $name, array $vars=[])
View an icon glyph.
Definition: views.php:1261
$vars
Definition: theme.php:5
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
elgg_extract_class(array $array, array|string $existing=[], string $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:277