HreflangBase.php in Metatag 8
File
metatag_hreflang/src/Plugin/metatag/Tag/HreflangBase.php
View source
<?php
namespace Drupal\metatag_hreflang\Plugin\metatag\Tag;
use Drupal\metatag\Plugin\metatag\Tag\LinkRelBase;
abstract class HreflangBase extends LinkRelBase {
public function output() {
$element = parent::output();
if ($element) {
$element['#attributes'] = [
'rel' => 'alternate',
'hreflang' => $this
->name(),
'href' => $element['#attributes']['href'],
];
}
return $element;
}
public function name() {
return str_replace('hreflang_', '', parent::name());
}
}
Classes
Name |
Description |
HreflangBase |
This base plugin allows "link hreflang" tags to be further customized. |