function Tags::implode

Implodes an array of tags into a string.

Parameters

array $tags: An array of tags.

Return value

string The imploded string.

2 calls to Tags::implode()
TagsTest::testImplodeTags in core/tests/Drupal/Tests/Core/Common/TagsTest.php
Implodes a series of tags.
TermTest::testNodeTermCreationAndDeletion in core/modules/taxonomy/tests/src/Functional/TermTest.php
Tests term creation with a free-tagging vocabulary from the node form.

File

core/lib/Drupal/Component/Utility/Tags.php, line 67

Class

Tags
Defines a class that can explode and implode tags.

Namespace

Drupal\Component\Utility

Code

public static function implode($tags) {
  $encoded_tags = [];
  foreach ($tags as $tag) {
    $encoded_tags[] = self::encode($tag);
  }
  return implode(', ', $encoded_tags);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.