You are here

public static function SchemaMetatagManager::explode in Schema.org Metatag 8

Same name and namespace in other branches
  1. 8.2 src/SchemaMetatagManager.php \Drupal\schema_metatag\SchemaMetatagManager::explode()

Explode values if this is a multiple value field.

Parameters

string $value: The value to explode.

Return value

array The array of values.

Overrides SchemaMetatagManagerInterface::explode

3 calls to SchemaMetatagManager::explode()
SchemaItemListElementBase::getItems in src/Plugin/metatag/Tag/SchemaItemListElementBase.php
Process the input value into an array of items.
SchemaMetatagManagerTest::testExplode in tests/src/Unit/SchemaMetatagManagerTest.php
@covers ::explode @dataProvider stringData
SchemaNameBase::processTestExplodeValue in src/Plugin/metatag/Tag/SchemaNameBase.php
Explode a test value.

File

src/SchemaMetatagManager.php, line 170

Class

SchemaMetatagManager
Class SchemaMetatagManager.

Namespace

Drupal\schema_metatag

Code

public static function explode($value) {
  $value = explode(',', $value);
  $value = array_map('trim', $value);

  // $value = array_unique($value);
  if (count($value) == 1) {
    return $value[0];
  }
  return $value;
}