Elgg  Version 2.3
label.php
Go to the documentation of this file.
1 <?php
2 
10 $label = elgg_extract('label', $vars, '');
12 $required = elgg_extract('required', $vars);
13 
14 if (!$label) {
15  return;
16 }
17 
18 if ($required) {
19  $indicator = elgg_extract('required_indicator', $vars);
20  if (!isset($indicator)) {
21  $indicator = elgg_format_element([
22  '#tag_name' => 'span',
23  'title' => elgg_echo('field:required'),
24  'class' => 'elgg-required-indicator',
25  '#text' => "&ast;",
26  ]);
27  }
28  if ($indicator) {
29  $label .= $indicator;
30  }
31 }
32 
33 echo elgg_format_element('label', [
34  'for' => $id,
35  'class' => 'elgg-field-label'
36  ], $label);
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$vars['entity']
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:208
$label
Form input label view.
Definition: label.php:10
elgg echo
Translates a string.
Definition: languages.js:48
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:1375
$required
Definition: label.php:12
$id
Definition: label.php:11