Elgg  Version 3.0
tags.php
Go to the documentation of this file.
1 <?php
18 function string_to_tag_array($string) {
19  if (!is_string($string)) {
20  return $string;
21  }
22 
23  $ar = explode(",", $string);
24  $ar = array_map('trim', $ar);
25  $ar = array_filter($ar, 'is_not_null');
26  $ar = array_map('strip_tags', $ar);
27  $ar = array_unique($ar);
28  return $ar;
29 }
30 
50 function elgg_get_tags(array $options = []) {
51  return _elgg_services()->metadataTable->getTags($options);
52 }
53 
69  return _elgg_services()->metadataTable->registerTagName($name);
70 }
71 
81  return _elgg_services()->metadataTable->unregisterTagName($name);
82 }
83 
91  return _elgg_services()->metadataTable->getTagNames();
92 }
93 
101 function _elgg_tags_init() {
102  // register the standard tags metadata name
104 }
105 
109 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
110  $events->registerHandler('init', 'system', '_elgg_tags_init');
111 };
elgg_get_registered_tag_metadata_names()
Returns an array of valid metadata names for tags.
Definition: tags.php:90
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
string_to_tag_array($string)
Takes in a comma-separated string and returns an array of tags which have been trimmed.
Definition: tags.php:18
Events service.
$options
Elgg admin footer.
Definition: footer.php:6
elgg_unregister_tag_metadata_name($name)
Unregister metadata tag name.
Definition: tags.php:80
Base class for events and hooks.
elgg_get_tags(array $options=[])
Get popular tags and their frequencies.
Definition: tags.php:50
elgg_register_tag_metadata_name($name)
Registers a metadata name as containing tags for an entity.
Definition: tags.php:68
_elgg_tags_init()
Tags init.
Definition: tags.php:101
_elgg_services()
Get the global service provider.
Definition: elgglib.php:1292