-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
[4.x] Add group field type #8836
[4.x] Add group field type #8836
Conversation
Ok, I have tested this field out on my project significantly and I think it is nearly if not completely bug free now 🤞 Let me know if there is something I should do differently. |
I jinxed myself, there was one more bug related to the field meta that was hard to track down. Should be all fixed now. |
LOOOOVE this one |
@duncanmcclean I didn't find an existing icon that I felt worked for this field type so that still needs to be changed. |
@godismyjudge95 I love this, thank you! Were you able to test this in a It should be registered here: https://github.com/statamic/cms/blob/4.x/src/Providers/ExtensionServiceProvider.php#L51 And the imports in the Vue shouldn't be from |
I didn't have a sandbox set up at the time when I built this (as we needed it on a project). So you are correct in saying it's mostly a copy and paste job - although I tried to clean up I must have missed the vendor paths. Didn't know there was an internal place to register the fields, I thought it would pick it up like the user space fields. |
Looks like @duncanmcclean has your back ❤️ |
All good! I've just pushed up some commits to adjust the namespace from For future reference, when you're adding something to Statamic, make sure to spin up a sandbox site so you can test and check that everything's wired up. 🙂 |
Thanks to the community call the other day I got my sandbox set up. And good thing too! Just now tested this and it appears everything is working except field validation (ie. required fields). If anyone has an idea as to why it might not be working, that would be great. Otherwise I'm gonna be fiddling with it to see if I can get it working. |
Okay, making some progress here with the UI, and it all works great as a top level field. Unfortunately, it seems to explode on the publish form page when used inside of a Grid. Here's the error: https://flareapp.io/share/q5YwnMeP |
Should be resolved now. |
Ok, I think I got the validation figured out. It validates all fields regardless of the nest level. I don't know if there is precedence for this, but should the validation rules be enabled at all on this field? As there is nothing to validate on the group itself it might not make sense for it to be there? I guess that can be a separate PR as non-input fields appear to have validation enabled on them (ie. Section, HTML, etc.) |
Let me know if there is anything else you'd like to see changed/fixed about this. |
Thank you so much for this! |
Thank you for the encouragement and the awesome CMS! It means a lot. |
Thank you @godismyjudge95 this is so useful. |
Amazing! Thanks everyone for this! |
Closes statamic/ideas#210
NOTE:
This is a very rough draft.I have never submitted substantial PR like this and would appreciate any direction that could be given.This PR is for allowing one to "group" fields together under a single variable. This helps manage scope overlap when using the same fields multiple times (like with fieldsets).
I currently use this to group a fieldset and a corresponding partial to render that fieldset.
Normally, anytime I include the fieldset multiple times that means I need to prefix all of those fields.
But with the group field type we could do something like this for a button fieldset with fields link, text, and external:
Here is a screenshot of what it looks like: