public static function SchemaNameBase::pivotItem in Schema.org Metatag 8
Same name and namespace in other branches
- 8.2 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 128
Class
- SchemaNameBase
- All Schema.org tags should extend this class.
Namespace
Drupal\schema_metatag\Plugin\metatag\TagCode
public static 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']);
/** @var \Drupal\schema_metatag\SchemaMetatagManagerInterface $schemaMetatagManager */
$schemaMetatagManager = \Drupal::service('schema_metatag.schema_metatag_manager');
$array = $schemaMetatagManager
->pivot($array);
}
foreach ($array as &$value) {
if (is_array($value)) {
$value = static::pivotItem($value);
}
}
return $array;
}