Elgg  Version 2.3
tags.php
Go to the documentation of this file.
1 <?php
12 $vars['class'] = elgg_extract_class($vars, 'elgg-input-tags');
13 
14 $defaults = array(
15  'value' => '',
16  'disabled' => false,
17  'autocapitalize' => 'off',
18  'type' => 'text'
19 );
20 
21 if (isset($vars['entity'])) {
22  $defaults['value'] = $vars['entity']->tags;
23  unset($vars['entity']);
24 }
25 
26 $vars = array_merge($defaults, $vars);
27 
28 if (is_array($vars['value'])) {
29  $tags = array();
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
elgg_extract_class(array $array, $existing=[])
Extract class names from an array with key "class", optionally merging into a preexisting set...
Definition: elgglib.php:1396
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:208
if(empty($vars['tags'])&&(!empty($value)||$value===0||$value=== '0')) if(empty($vars['tags'])&&$value!==0 &&$value!== '0') $tags
Definition: tags.php:28
elgg echo
Translates a string.
Definition: languages.js:48
$defaults
Definition: tags.php:14