Skip to content

Commit

Permalink
Merge pull request #3200 from vlad-ghita/collection-field-set
Browse files Browse the repository at this point in the history
Fix setting new fields on collection.
  • Loading branch information
bobdenotter authored May 9, 2022
2 parents 78f45e3 + e3a83aa commit 8ffd416
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Backend/ContentEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit 8ffd416

Please sign in to comment.