function drupal_implode_tags

Implodes an array of tags into a string.

See also

drupal_explode_tags()

6 calls to drupal_implode_tags()
AutocompleteTagsUnitTest::testDrupalImplodeTags in drupal/core/modules/system/lib/Drupal/system/Tests/Common/AutocompleteTagsUnitTest.php
Implodes a series of tags.
comment_unpublish_by_keyword_action_form in drupal/core/modules/comment/comment.module
Form constructor for the blacklisted keywords form.
node_unpublish_by_keyword_action_form in drupal/core/modules/node/node.module
Generates settings form for node_unpublish_by_keyword_action().
taxonomy_autocomplete in drupal/core/modules/taxonomy/taxonomy.pages.inc
Page callback: Outputs JSON for taxonomy autocomplete suggestions.
TermTest::testNodeTermCreationAndDeletion in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
Test term creation with a free-tagging vocabulary from the node form.

... See full list

File

drupal/core/includes/common.inc, line 6521
Common functions that many Drupal modules will need to reference.

Code

function drupal_implode_tags($tags) {
  $encoded_tags = array();
  foreach ($tags as $tag) {

    // Commas and quotes in tag names are special cases, so encode them.
    if (strpos($tag, ',') !== FALSE || strpos($tag, '"') !== FALSE) {
      $tag = '"' . str_replace('"', '""', $tag) . '"';
    }
    $encoded_tags[] = $tag;
  }
  return implode(', ', $encoded_tags);
}