You are here

public function LinkRelBase::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 MetaNameBase::output

3 calls to LinkRelBase::output()
HreflangBase::output in metatag_hreflang/src/Plugin/metatag/Tag/HreflangBase.php
Generate the HTML tag output for a meta tag.
LinkMediaBase::output in metatag_mobile/src/Plugin/metatag/Tag/LinkMediaBase.php
Generate the HTML tag output for a meta tag.
LinkSizesBase::output in metatag_favicons/src/Plugin/metatag/Tag/LinkSizesBase.php
Generate the HTML tag output for a meta tag.
3 methods override LinkRelBase::output()
HreflangBase::output in metatag_hreflang/src/Plugin/metatag/Tag/HreflangBase.php
Generate the HTML tag output for a meta tag.
LinkMediaBase::output in metatag_mobile/src/Plugin/metatag/Tag/LinkMediaBase.php
Generate the HTML tag output for a meta tag.
LinkSizesBase::output in metatag_favicons/src/Plugin/metatag/Tag/LinkSizesBase.php
Generate the HTML tag output for a meta tag.

File

src/Plugin/metatag/Tag/LinkRelBase.php, line 13

Class

LinkRelBase
This base plugin allows "link rel" tags to be further customized.

Namespace

Drupal\metatag\Plugin\metatag\Tag

Code

public function output() {
  $element = parent::output();
  if (!empty($element['#attributes']['content'])) {
    $element['#tag'] = 'link';
    $element['#attributes'] = [
      'rel' => $this
        ->name(),
      'href' => $element['#attributes']['content'],
    ];
    unset($element['#attributes']['content']);
  }
  return $element;
}