Skip to content

Commit b96ab77

Browse files
committed
improve item label for the validation schema
1 parent 13e552f commit b96ab77

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Fields/FormSchemas/ValidationRulesSchema.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
namespace Backstage\Fields\Fields\FormSchemas;
44

5-
use Backstage\Fields\Fields\Helpers\FieldOptionsHelper;
65
use Filament\Forms;
6+
use Illuminate\Support\Str;
7+
use Backstage\Fields\Fields\Helpers\FieldOptionsHelper;
78

89
class ValidationRulesSchema
910
{
@@ -159,7 +160,7 @@ public static function make(): array
159160
->visible(fn (Forms\Get $get): bool => $get('type') === 'enum'),
160161
])
161162
->collapsible()
162-
->itemLabel(fn (array $state): ?string => $state['type'] ?? null)
163+
->itemLabel(fn (array $state): ?string => $state['type'] ? str_replace('_', ' ', Str::title($state['type'])) : null)
163164
->defaultItems(0)
164165
->columns(3)
165166
->reorderableWithButtons()

0 commit comments

Comments
 (0)