Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / metatag / src / Plugin / metatag / Tag / MetaNameBase.php
index 5eafb805a04b37e02ea237b7f451cf13f86519c6..9212571ef2f17a72784f639114a21ca0165919cb 100644 (file)
@@ -314,15 +314,17 @@ abstract class MetaNameBase extends PluginBase {
    *   A render array or an empty string.
    */
   public function output() {
-    // Parse out the image URL, if needed.
-    $value = $this->parseImageUrl();
-    $value = $this->tidy($value);
-
-    if (empty($value)) {
+    if (empty($this->value)) {
       // If there is no value, we don't want a tag output.
-      $element = '';
+      return $this->multiple() ? [] : '';
     }
-    else {
+
+    // Parse out the image URL, if needed.
+    $value = $this->parseImageUrl();
+    $values = $this->multiple() ? explode(',', $value) : [$value];
+    $elements = [];
+    foreach ($values as $value) {
+      $value = $this->tidy($value);
       if ($this->requiresAbsoluteUrl()) {
         // Relative URL.
         if (parse_url($value, PHP_URL_HOST) == NULL) {
@@ -339,7 +341,7 @@ abstract class MetaNameBase extends PluginBase {
         $value = str_replace('http://', 'https://', $value);
       }
 
-      $element = [
+      $elements[] = [
         '#tag' => 'meta',
         '#attributes' => [
           $this->nameAttribute => $this->name,
@@ -348,7 +350,7 @@ abstract class MetaNameBase extends PluginBase {
       ];
     }
 
-    return $element;
+    return $this->multiple() ? $elements : reset($elements);
   }
 
   /**