Elgg  Version master
field.php
Go to the documentation of this file.
1 <?php
13 if (elgg_is_empty($value)) {
14  return;
15 }
16 
17 $icon = (string) elgg_extract('icon', $vars);
18 if ($icon && !str_starts_with($icon, '<')) {
20 }
21 
22 if ($icon) {
23  $icon = elgg_format_element('span', [
24  'class' => 'elgg-profile-field-icon',
25  ], $icon);
26 }
27 
28 $label = (string) elgg_extract('label', $vars);
29 $label = elgg_format_element('span', [
30  'class' => 'elgg-profile-field-label',
31 ], $icon . $label);
32 
33 echo elgg_format_element('div', [
34  'class' => elgg_extract_class($vars, ['elgg-profile-field']),
35  'data-name' => elgg_extract('name', $vars),
36 ], $label . $value);
if($view &&elgg_view_exists($view)) $label
Definition: field.php:26
elgg_is_empty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: input.php:176
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
$value
Outputs a field with a label.
Definition: field.php:12
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
if(elgg_is_empty($value)) $icon
Definition: field.php:17