public function SchemaNameBase::output 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::output()
Generate the HTML tag output for a meta tag.
Return value
array|string A render array or an empty string.
Overrides MetaNameBase::output
1 call to SchemaNameBase::output()
- SchemaDurationBase::output in src/
Plugin/ metatag/ Tag/ SchemaDurationBase.php - Generate the HTML tag output for a meta tag.
1 method overrides SchemaNameBase::output()
- SchemaDurationBase::output in src/
Plugin/ metatag/ Tag/ SchemaDurationBase.php - Generate the HTML tag output for a meta tag.
File
- src/
Plugin/ metatag/ Tag/ SchemaNameBase.php, line 66
Class
- SchemaNameBase
- All Schema.org tags should extend this class.
Namespace
Drupal\schema_metatag\Plugin\metatag\TagCode
public function output() {
$value = $this
->schemaMetatagManager()
->unserialize($this
->value());
// If this is a complex array of value, process the array.
if (is_array($value)) {
// Clean out empty values.
$value = $this
->schemaMetatagManager()
->arrayTrim($value);
}
if (empty($value)) {
return '';
}
elseif (is_array($value)) {
// If the item is an array of values,
// walk the array and process the values.
array_walk_recursive($value, 'static::processItem');
// Recursively pivot each branch of the array.
$value = static::pivotItem($value);
}
else {
$this
->processItem($value);
}
$output = [
'#tag' => 'meta',
'#attributes' => [
'name' => $this->name,
'content' => static::outputValue($value),
'group' => $this->group,
'schema_metatag' => TRUE,
],
];
return $output;
}