* 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) {
$value = str_replace('http://', 'https://', $value);
}
- $element = [
+ $elements[] = [
'#tag' => 'meta',
'#attributes' => [
$this->nameAttribute => $this->name,
];
}
- return $element;
+ return $this->multiple() ? $elements : reset($elements);
}
/**