You are here

public function PropertyTypeBase::processedTestValue in Schema.org Metatag 8.2

Provide a test output value for the input value.

Tags that return values in a different format than the input, like values that are exploded, should extend this method and return a valid value.

Parameters

mixed $items: The input value, either a string or an array.

Return value

mixed Return the correct output value.

Overrides SchemaMetatagTestTagInterface::processedTestValue

File

src/Plugin/schema_metatag/PropertyTypeBase.php, line 341

Class

PropertyTypeBase
Base class for Property type plugins.

Namespace

Drupal\schema_metatag\Plugin\schema_metatag

Code

public function processedTestValue($items) {
  if (empty($this
    ->getSubProperties())) {
    return $this
      ->processTestExplodeValue($items);
  }
  else {
    foreach ($this
      ->getSubProperties() as $property_name => $values) {
      $items[$property_name] = $this
        ->getChildPropertyType($values['id'])
        ->processedTestValue($items[$property_name]);
    }
  }
  return $items;
}