function autocomplete_deluxe_taxonomy_implode_tags in Autocomplete Deluxe 7
Same name and namespace in other branches
- 7.2 autocomplete_deluxe.module \autocomplete_deluxe_taxonomy_implode_tags()
Implodes the tags from the taxonomy module.
This function is essentially the same as axonomy_implode_tags, with the difference, that it uses only a comma instead of a comma and a space to implode the tags. It will help keep problems with delimiters to a minimum.
1 call to autocomplete_deluxe_taxonomy_implode_tags()
File
- ./
autocomplete_deluxe.module, line 143 - Define enhanced autocomplete wdiget.
Code
function autocomplete_deluxe_taxonomy_implode_tags($tags, $vid = NULL) {
$typed_tags = array();
foreach ($tags as $tag) {
// Extract terms belonging to the vocabulary in question.
if (!isset($vid) || $tag->vid == $vid) {
// Make sure we have a completed loaded taxonomy term.
if (isset($tag->name)) {
// Commas and quotes in tag names are special cases, so encode 'em.
if (strpos($tag->name, ',') !== FALSE || strpos($tag->name, '"') !== FALSE) {
$tag->name = '"' . str_replace('"', '""', $tag->name) . '"';
}
$typed_tags[] = $tag->name;
}
}
}
return implode(',', $typed_tags);
}