Skip to content

Commit 4cc7826

Browse files
Improve error return from form field configuration
1 parent f25aa2b commit 4cc7826

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Console/ConfigureCmsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function updateCmsConfigurationFor($model, int $order = 1, bool $isSubCo
150150
'content' => $form->contentField()?->toArray(),
151151
'fields' => $form
152152
->customFields()
153-
->map(fn (OzuField $field) => $field->toArray()),
153+
->mapWithKeys(fn (OzuField $field) => [$field->getKey() => $field->toArray()]),
154154
],
155155
'customFields' => collect(Schema::getColumnListing($model->getTable()))
156156
->filter(fn (string $column) => !in_array($column, $model::$ozuColumns))

src/OzuCms/Form/OzuField.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public function setIsUpdatable(bool $isUpdatable = true): self
8686

8787
abstract public function type(): string;
8888

89+
public function getKey(): string
90+
{
91+
return $this->key;
92+
}
93+
8994
public function toArray(): array
9095
{
9196
return [

0 commit comments

Comments
 (0)