File tree Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields ;
4+
5+ use Statikbe \FilamentFlexibleContentBlocks \Filament \Form \Fields \TitleField ;
6+
7+ class LabelField extends TitleField
8+ {
9+ const FIELD = 'label ' ;
10+
11+ public static function create (bool $ required = false ): static
12+ {
13+ $ field = static ::getFieldName ();
14+
15+ return parent ::create ($ required )
16+ ->label (flexiblePagesTrans ('menu_items.form.label_lbl ' ));
17+ }
18+
19+ public static function getFieldName (): string
20+ {
21+ return self ::FIELD ;
22+ }
23+ }
Original file line number Diff line number Diff line change 88use Filament \Forms \Components \TextInput ;
99use Filament \Forms \Components \Toggle ;
1010use Filament \Forms \Get ;
11+ use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \LabelField ;
1112use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \Types \AbstractMenuItemType ;
1213use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \Types \LinkableMenuItemType ;
1314use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \Types \RouteMenuItemType ;
@@ -84,19 +85,10 @@ protected static function getLinkTypeField(): Select
8485
8586 protected static function getLabelField (): TextInput
8687 {
87- $ field = new class extends TextInput
88- {
89- use HasTranslatableHint;
90- };
91-
92- return $ field ::make (static ::FIELD_LABEL )
93- ->label (flexiblePagesTrans ('menu_items.form.label_lbl ' ))
88+ return LabelField::create ()
9489 ->required (fn (Get $ get ): bool => ! $ get (static ::FIELD_USE_MODEL_TITLE ))
9590 ->visible (fn (Get $ get ): bool => ! $ get (static ::FIELD_USE_MODEL_TITLE ))
96- ->maxLength (255 )
97- ->helperText (flexiblePagesTrans ('menu_items.form.label_help ' ))
98- ->live ()
99- ->addsTranslatableHint ();
91+ ->helperText (flexiblePagesTrans ('menu_items.form.label_help ' ));
10092 }
10193
10294 protected static function getUseModelTitleField (): Toggle
You can’t perform that action at this time.
0 commit comments