Elgg  Version 3.0
tags.php
Go to the documentation of this file.
1 <?php
12 $vars['class'] = elgg_extract_class($vars, 'elgg-input-tags');
13 
15  'value' => '',
16  'disabled' => false,
17  'autocapitalize' => 'off',
18  'type' => 'text'
19 ];
20 
21 if (isset($vars['entity'])) {
22  $defaults['value'] = elgg_extract('entity', $vars)->tags;
23  unset($vars['entity']);
24 }
25 
26 $vars = array_merge($defaults, $vars);
27 
28 if (is_array($vars['value'])) {
29  $tags = [];
30 
31  foreach ($vars['value'] as $tag) {
32  if (is_string($tag)) {
33  $tags[] = $tag;
34  } else {
35  $tags[] = $tag->value;
36  }
37  }
38 
39  $vars['value'] = implode(", ", $tags);
40 }
41 
$vars['class']
Elgg tag input Displays a tag input field.
Definition: tags.php:12
if(!is_string($title)||$title=== '') $tag
Definition: title.php:19
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
$defaults
Definition: tags.php:14
$tags
Output object tags.
Definition: tags.php:9