public function HreflangBase::output in Metatag 8
Generate the HTML tag output for a meta tag.
Return value
array|string A render array or an empty string.
Overrides LinkRelBase::output
File
- metatag_hreflang/
src/ Plugin/ metatag/ Tag/ HreflangBase.php, line 15
Class
- HreflangBase
- This base plugin allows "link hreflang" tags to be further customized.
Namespace
Drupal\metatag_hreflang\Plugin\metatag\TagCode
public function output() {
$element = parent::output();
if ($element) {
// Rewrite the attributes so the hreflang value is before the href value.
$element['#attributes'] = [
'rel' => 'alternate',
'hreflang' => $this
->name(),
'href' => $element['#attributes']['href'],
];
}
return $element;
}