You are here

public function SchemaNameBase::pivotItem in Schema.org Metatag 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/metatag/Tag/SchemaNameBase.php \Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase::pivotItem()
1 call to SchemaNameBase::pivotItem()
SchemaNameBase::output in src/Plugin/metatag/Tag/SchemaNameBase.php
Generate the HTML tag output for a meta tag.

File

src/Plugin/metatag/Tag/SchemaNameBase.php, line 234

Class

SchemaNameBase
All Schema.org tags should extend this class.

Namespace

Drupal\schema_metatag\Plugin\metatag\Tag

Code

public function pivotItem($array) {

  // See if any nested items need to be pivoted.
  // If pivot is set to 0, it would have been removed as an empty value.
  if (array_key_exists('pivot', $array)) {
    unset($array['pivot']);
    $array = $this
      ->schemaMetatagManager()
      ->pivot($array);
  }
  foreach ($array as &$value) {
    if (is_array($value)) {
      $value = $this
        ->pivotItem($value);
    }
  }
  return $array;
}