Skip to content

Commit

Permalink
[Clacoform] fixes edition of empty entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Oct 9, 2024
1 parent b32c142 commit 2772751
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugin/claco-form/Serializer/EntrySerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,14 @@ public function serialize(Entry $entry, array $options = []): array
'clacoForm' => [ // should not be exposed here
'id' => $entry->getClacoForm()->getUuid(),
],
'values' => $this->serializeValues($entry),
];

$fieldValues = $this->serializeValues($entry);
if (!empty($fieldValues)) {
// don't send an empty array, because the ui expect an object here
$serialized['values'] = $fieldValues;
}

if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
$serialized = array_merge($serialized, [
'categories' => $this->getCategories($entry),
Expand Down

0 comments on commit 2772751

Please sign in to comment.