Skip to content

Commit 8be9b04

Browse files
committed
fix: option type when creating new records
1 parent caf0e3f commit 8be9b04

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Concerns/HasDatalist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static function addDatalistToInput(mixed $input, mixed $field): mixed
2121
public static function getDatalistConfig(): array
2222
{
2323
return array_merge(static::getSelectableValuesConfig(), [
24-
'datalistType' => null,
24+
'datalistType' => [],
2525
]);
2626
}
2727

src/Concerns/HasOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static function addOptionsToInput(mixed $input, mixed $field): mixed
2121
public static function getOptionsConfig(): array
2222
{
2323
return array_merge(static::getSelectableValuesConfig(), [
24-
'optionType' => null,
24+
'optionType' => [],
2525
]);
2626
}
2727

src/Concerns/HasSelectableValues.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ protected function selectableValuesFormFields(string $type, string $label, strin
145145
])
146146
->afterStateHydrated(function (Forms\Get $get, Forms\Set $set) use ($type) {
147147
$value = $get("config.{$type}");
148-
if (is_string($value)) {
149-
$set("config.{$type}", [$value]);
150-
}
148+
149+
// Set correct config value when creating records
150+
$set("config.{$type}", is_array($value) ? $value : (is_bool($value) ? [] : [$value]));
151151
})
152152
->label(__('Type'))
153153
->live(),

0 commit comments

Comments
 (0)