-
-
Notifications
You must be signed in to change notification settings - Fork 605
[6.x] Add extra sections with fields to existing fieldtypes #13796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 6.x
Are you sure you want to change the base?
[6.x] Add extra sections with fields to existing fieldtypes #13796
Conversation
|
Related: #12723 |
|
|
||
| private function extraConfigFieldsUseSections($extras) | ||
| { | ||
| return collect($extras)->filter(fn ($field) => Arr::has($field, 'fields')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| protected function extraConfigFieldItems(): array |
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