Skip to content

Commit

Permalink
Revert unnecessary change
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Nov 11, 2024
1 parent 49a67de commit fc76eb2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ public function data($defaults = false, bool $includeNulls = true): array
$data = $this->values;

foreach ($this->fields as $field) {
if ($field->unset() === true) {
$data[$field->name()] = null;
if ($field->isSaveable() === false || $field->unset() === true) {
if ($includeNulls === true) {
$data[$field->name()] = null;
} else {
unset($data[$field->name()]);
}
} else {
$data[$field->name()] = $field->toStoredValue($defaults);
}
}

if ($includeNulls === false) {
$data = array_filter($data, fn ($value) => $value !== null);
}

return $data;
}

Expand Down

0 comments on commit fc76eb2

Please sign in to comment.