Elgg  Version 1.9
tags.php
Go to the documentation of this file.
1 <?php
12 if (isset($vars['class'])) {
13  $vars['class'] = "elgg-input-tags {$vars['class']}";
14 } else {
15  $vars['class'] = "elgg-input-tags";
16 }
17 
18 $defaults = array(
19  'value' => '',
20  'disabled' => false,
21  'autocapitalize' => 'off',
22 );
23 
24 if (isset($vars['entity'])) {
25  $defaults['value'] = $vars['entity']->tags;
26  unset($vars['entity']);
27 }
28 
29 $vars = array_merge($defaults, $vars);
30 
31 if (is_array($vars['value'])) {
32  $tags = array();
33 
34  foreach ($vars['value'] as $tag) {
35  if (is_string($tag)) {
36  $tags[] = $tag;
37  } else {
38  $tags[] = $tag->value;
39  }
40  }
41 
42  $vars['value'] = implode(", ", $tags);
43 }
44 
45 ?>
46 <input type="text" <?php echo elgg_format_attributes($vars); ?> />
$tags
Definition: summary.php:41
if(isset($vars['entity'])) $vars
Definition: tags.php:29
elgg echo
Translates a string.
Definition: languages.js:43
elgg_format_attributes(array $attrs=array())
Converts an associative array into a string of well-formed attributes.
Definition: output.php:118
$defaults
Definition: tags.php:18
list style type
Definition: admin.php:724
elgg table input[type=checkbox]
Definition: admin.php:392