File tree Expand file tree Collapse file tree 4 files changed +34
-10
lines changed
src/Filament/Integration/Builders Expand file tree Collapse file tree 4 files changed +34
-10
lines changed Original file line number Diff line number Diff line change 1414
1515class FormBuilder extends BaseBuilder
1616{
17- private bool $ withoutSections = false ;
17+ private ? bool $ withoutSections = null ;
1818
1919 public function build (): Grid
2020 {
21- return FormContainer::make ()
21+ $ container = FormContainer::make ()
2222 ->forModel ($ this ->explicitModel ?? null )
23- ->withoutSections ($ this ->withoutSections )
2423 ->only ($ this ->only )
2524 ->except ($ this ->except );
25+
26+ // Only set withoutSections if explicitly configured
27+ if ($ this ->withoutSections !== null ) {
28+ $ container ->withoutSections ($ this ->withoutSections );
29+ }
30+
31+ return $ container ;
2632 }
2733
2834 public function withoutSections (bool $ withoutSections = true ): static
Original file line number Diff line number Diff line change 44
55use Filament \Schemas \Components \Grid ;
66use Illuminate \Database \Eloquent \Model ;
7+ use Relaticle \CustomFields \Enums \CustomFieldsFeature ;
8+ use Relaticle \CustomFields \FeatureSystem \FeatureManager ;
79
810final class FormContainer extends Grid
911{
@@ -13,7 +15,7 @@ final class FormContainer extends Grid
1315
1416 private array $ only = [];
1517
16- private bool $ withoutSections = false ;
18+ private ? bool $ withoutSections = null ;
1719
1820 public static function make (array |int |null $ columns = 12 ): static
1921 {
@@ -62,11 +64,15 @@ private function generateSchema(): array
6264 return []; // Graceful fallback
6365 }
6466
67+ // Use explicit setting if provided, otherwise check feature flag
68+ $ withoutSections = $ this ->withoutSections
69+ ?? FeatureManager::isEnabled (CustomFieldsFeature::UI_FLAT_FIELD_LAYOUT );
70+
6571 $ builder = app (FormBuilder::class);
6672
6773 return $ builder
6874 ->forModel ($ model )
69- ->withoutSections ($ this -> withoutSections )
75+ ->withoutSections ($ withoutSections )
7076 ->only ($ this ->only )
7177 ->except ($ this ->except )
7278 ->values ()
Original file line number Diff line number Diff line change @@ -21,17 +21,23 @@ final class InfolistBuilder extends BaseBuilder
2121
2222 private bool $ visibleWhenFilled = false ;
2323
24- private bool $ withoutSections = false ;
24+ private ? bool $ withoutSections = null ;
2525
2626 public function build (): Component
2727 {
28- return InfolistContainer::make ()
28+ $ container = InfolistContainer::make ()
2929 ->forModel ($ this ->explicitModel ?? null )
3030 ->hiddenLabels ($ this ->hiddenLabels )
3131 ->visibleWhenFilled ($ this ->visibleWhenFilled )
32- ->withoutSections ($ this ->withoutSections )
3332 ->only ($ this ->only )
3433 ->except ($ this ->except );
34+
35+ // Only set withoutSections if explicitly configured
36+ if ($ this ->withoutSections !== null ) {
37+ $ container ->withoutSections ($ this ->withoutSections );
38+ }
39+
40+ return $ container ;
3541 }
3642
3743 /**
Original file line number Diff line number Diff line change 55use Filament \Forms \Components \Field ;
66use Filament \Schemas \Components \Grid ;
77use Illuminate \Database \Eloquent \Model ;
8+ use Relaticle \CustomFields \Enums \CustomFieldsFeature ;
9+ use Relaticle \CustomFields \FeatureSystem \FeatureManager ;
810
911final class InfolistContainer extends Grid
1012{
@@ -18,7 +20,7 @@ final class InfolistContainer extends Grid
1820
1921 private bool $ visibleWhenFilled = false ;
2022
21- private bool $ withoutSections = false ;
23+ private ? bool $ withoutSections = null ;
2224
2325 public static function make (array |int |null $ columns = 12 ): static
2426 {
@@ -84,13 +86,17 @@ private function generateSchema(): array
8486 return []; // Graceful fallback
8587 }
8688
89+ // Use explicit setting if provided, otherwise check feature flag
90+ $ withoutSections = $ this ->withoutSections
91+ ?? FeatureManager::isEnabled (CustomFieldsFeature::UI_FLAT_FIELD_LAYOUT );
92+
8793 $ builder = app (InfolistBuilder::class)
8894 ->forModel ($ model )
8995 ->only ($ this ->only )
9096 ->except ($ this ->except )
9197 ->hiddenLabels ($ this ->hiddenLabels )
9298 ->visibleWhenFilled ($ this ->visibleWhenFilled )
93- ->withoutSections ($ this -> withoutSections );
99+ ->withoutSections ($ withoutSections );
94100
95101 return $ builder ->values ()->toArray ();
96102 }
You can’t perform that action at this time.
0 commit comments