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 8
8
use Filament \Forms \Components \TextInput ;
9
9
use Filament \Forms \Components \Toggle ;
10
10
use Filament \Forms \Get ;
11
+ use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \LabelField ;
11
12
use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \Types \AbstractMenuItemType ;
12
13
use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \Types \LinkableMenuItemType ;
13
14
use Statikbe \FilamentFlexibleContentBlockPages \Filament \Form \Fields \Types \RouteMenuItemType ;
@@ -84,19 +85,10 @@ protected static function getLinkTypeField(): Select
84
85
85
86
protected static function getLabelField (): TextInput
86
87
{
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 ()
94
89
->required (fn (Get $ get ): bool => ! $ get (static ::FIELD_USE_MODEL_TITLE ))
95
90
->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 ' ));
100
92
}
101
93
102
94
protected static function getUseModelTitleField (): Toggle
You can’t perform that action at this time.
0 commit comments