Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Component/Utility/Tags.php \Drupal\Component\Utility\Tags::implode()
  2. 9 core/lib/Drupal/Component/Utility/Tags.php \Drupal\Component\Utility\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);
}