From e3a83aa66d3c7469dddada57bcfeb0cce3cfb0e7 Mon Sep 17 00:00:00 2001 From: Vlad Ghita Date: Mon, 9 May 2022 14:56:08 +0300 Subject: [PATCH] Fix setting new fields on collection. --- src/Controller/Backend/ContentEditController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller/Backend/ContentEditController.php b/src/Controller/Backend/ContentEditController.php index 30fe890db..b6fc568de 100644 --- a/src/Controller/Backend/ContentEditController.php +++ b/src/Controller/Backend/ContentEditController.php @@ -459,13 +459,13 @@ public function updateCollections(Content $content, array $formData, ?string $lo $collection = $this->getFieldToUpdate($content, $collectionName, $collectionDefinition); + $newFields = []; foreach ($collectionItems as $name => $instances) { // order field is only used to determine the order in which fields are submitted if ($name === 'order') { continue; } - $newFields = []; foreach ($instances as $orderId => $value) { $order = $orderArray[$orderId]; $fieldDefinition = $collection->getDefinition()->get('fields')->get($name); @@ -478,8 +478,8 @@ public function updateCollections(Content $content, array $formData, ?string $lo $this->updateField($field, $value, $locale); $tm->applyTranslations($field, $collectionName, $orderId); } - $collection->setValue($newFields); } + $collection->setValue($newFields); } } }