diff --git a/src/Plugin/metatag/Tag/SchemaNameBase.php b/src/Plugin/metatag/Tag/SchemaNameBase.php index 69003eb..df97393 100644 --- a/src/Plugin/metatag/Tag/SchemaNameBase.php +++ b/src/Plugin/metatag/Tag/SchemaNameBase.php @@ -97,29 +97,13 @@ class SchemaNameBase extends MetaNameBase { return $array; } - /** - * Nested elements that cannot be exploded. - * - * @return array - * Array of keys that might contain commas, or otherwise cannot be exploded. - */ - protected function neverExplode() { - return [ - 'streetAddress', - 'reviewBody', - 'recipeInstructions', - ]; - } - /** * {@inheritdoc} */ protected function processItem(&$value, $key = 0) { - $explode = $key === 0 ? $this->multiple() : !in_array($key, $this->neverExplode()); - // Parse out the image URL, if needed. - $value = $this->parseImageUrlValue($value, $explode); + $value = $this->parseImageUrlValue($value); $value = trim($value); @@ -127,12 +111,10 @@ class SchemaNameBase extends MetaNameBase { if ($this->secure() && strpos($value, 'http://') !== FALSE) { $value = str_replace('http://', 'https://', $value); } - if ($explode) { - $value = SchemaMetatagManager::explode($value); - // Clean out any empty values that might have been added by explode(). - if (is_array($value)) { - $value = array_filter($value); - } + $value = SchemaMetatagManager::explode($value); + // Clean out any empty values that might have been added by explode(). + if (is_array($value)) { + $value = array_filter($value); } } @@ -142,7 +124,7 @@ class SchemaNameBase extends MetaNameBase { * A copy of the base method of the same name, but where $value is passed * in instead of assumed to be $this->value(). */ - protected function parseImageUrlValue($value, $explode) { + protected function parseImageUrlValue($value) { // If this contains embedded image tags, extract the image URLs. if ($this->type() === 'image') { @@ -154,12 +136,7 @@ class SchemaNameBase extends MetaNameBase { } if (strip_tags($value) != $value) { - if ($explode) { - $values = explode(',', $value); - } - else { - $values = [$value]; - } + $values = explode(METATAG_MULTIPLE_VALUE_DELIMITER, $value); // Check through the value(s) to see if there are any image tags. foreach ($values as $key => $val) { @@ -169,7 +146,7 @@ class SchemaNameBase extends MetaNameBase { $values[$key] = $matches[1]; } } - $value = implode(',', $values); + $value = implode(METATAG_MULTIPLE_VALUE_DELIMITER, $values); // Remove any HTML tags that might remain. $value = strip_tags($value); diff --git a/src/SchemaMetatagManager.php b/src/SchemaMetatagManager.php index 8d6fae2..0564e59 100644 --- a/src/SchemaMetatagManager.php +++ b/src/SchemaMetatagManager.php @@ -169,7 +169,7 @@ class SchemaMetatagManager implements SchemaMetatagManagerInterface { * {@inheritdoc} */ public static function explode($value) { - $value = explode(',', $value); + $value = explode(METATAG_MULTIPLE_VALUE_DELIMITER, $value); $value = array_map('trim', $value); //$value = array_unique($value); if (count($value) == 1) {