From 1df2729bf4ba0ff488d813ba0b5243f8364f3bfe Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 19 Apr 2023 14:47:58 -0300 Subject: [PATCH] (Re)initialize `$formatted_dates`. Avoid accumulating multiple values. --- src/Plugin/Field/FieldFormatter/EDTFFormatter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Plugin/Field/FieldFormatter/EDTFFormatter.php b/src/Plugin/Field/FieldFormatter/EDTFFormatter.php index 88f15d0..53e98b3 100644 --- a/src/Plugin/Field/FieldFormatter/EDTFFormatter.php +++ b/src/Plugin/Field/FieldFormatter/EDTFFormatter.php @@ -158,6 +158,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) { // Sets. if (strpos($item->value, '[') !== FALSE || strpos($item->value, '{') !== FALSE) { $set_qualifier = (strpos($item->value, '[') !== FALSE) ? t('one of the dates:') : t('all of the dates:'); + $formatted_dates = []; foreach (explode(',', trim($item->value, '{}[] ')) as $date) { $date_range = explode('..', $date); switch (count($date_range)) {