You are here

public function BreadcrumbList::outputValue in Schema.org Metatag 8.2

Transform input value to its display output.

Types that need to transform the output to something different than the stored value should extend this method and do the transformation here.

Parameters

mixed $input_value: Input value, could be either a string or array. This will be the value after token replacement.

Return value

mixed Return the (possibly expanded) value which will be rendered in JSON-LD.

Overrides ItemListElement::outputValue

File

src/Plugin/schema_metatag/PropertyType/BreadcrumbList.php, line 53

Class

BreadcrumbList
Provides a plugin for the 'ItemListElement' Schema.org property type.

Namespace

Drupal\schema_metatag\Plugin\schema_metatag\PropertyType

Code

public function outputValue($input_value) {
  $output_value = parent::outputValue($input_value);
  $items = [];
  if (!empty($output_value)) {
    $items = [
      "@type" => "BreadcrumbList",
      "itemListElement" => $output_value,
    ];
  }
  return $items;
}