Version 1
[yaffs-website] / web / modules / contrib / metatag / src / Plugin / metatag / Tag / LinkRelBase.php
diff --git a/web/modules/contrib/metatag/src/Plugin/metatag/Tag/LinkRelBase.php b/web/modules/contrib/metatag/src/Plugin/metatag/Tag/LinkRelBase.php
new file mode 100644 (file)
index 0000000..e482cf3
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\metatag\Plugin\metatag\Tag;
+
+/**
+ * This base plugin allows "link rel" tags to be further customized.
+ */
+abstract class LinkRelBase extends MetaNameBase {
+
+  /**
+   * Display the meta tag.
+   */
+  public function output() {
+    $element = parent::output();
+    if ($element) {
+      $element['#tag'] = 'link';
+      $element['#attributes'] = [
+        'rel' => $this->name(),
+        'href' => $element['#attributes']['content'],
+      ];
+      unset($element['#attributes']['content']);
+    }
+
+    return $element;
+  }
+
+}