[6.x] Add extra sections with fields to existing fieldtypes#13796
[6.x] Add extra sections with fields to existing fieldtypes#13796nopticon wants to merge 6 commits intostatamic:6.xfrom
Conversation
|
Related: #12723 |
|
|
||
| private function extraConfigFieldsUseSections($extras) | ||
| { | ||
| return collect($extras)->filter(fn ($field) => Arr::has($field, 'fields')); |
There was a problem hiding this comment.
Not sure this is the right way to check, as replicators and bards both have fields so this check would mark them both as sections.
There was a problem hiding this comment.
Hi @ryanmitchell Are you referring to replicators and bard fields that you want to add with appendConfigFields method? Something like this:
This check does validate fields key on the first level of the array generated by
Line 293 in 80f7049
fields keys, so I haven't seen the behavior that you mentioned. This PR does not affect other existing fields beside the ones that you define calling appendConfigField or appendConfigFields method.
I did a lot of tests in my dev site and all fields seems to be working fine, if you see something weird is happening please let me know. Thanks for your review!
This is how it looks for my custom test calling Text::appendConfigFields():
After reading https://statamic.dev/fieldtypes/build-a-fieldtype#adding-config-fields-to-existing-fieldtypes I noticed that extra sections are not added to fieldtype config.
Before this fix, it shows like this:
After fixing this issue, it shows fields inside the new section:
After adding
appendConfigFieldsto a ServiceProvider, it can be tested on any blueprint at/cp/collections/{collection}/blueprints/{blueprint}/edit