function Tags::implode

Same name in other branches
  1. 9 core/lib/Drupal/Component/Utility/Tags.php \Drupal\Component\Utility\Tags::implode()
  2. 10 core/lib/Drupal/Component/Utility/Tags.php \Drupal\Component\Utility\Tags::implode()
  3. 11.x 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.

4 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
Test term creation with a free-tagging vocabulary from the node form.
UnpublishByKeywordComment::buildConfigurationForm in core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php
Form constructor.
UnpublishByKeywordNode::buildConfigurationForm in core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php
Form constructor.

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.