Home › Forums › Feature Requests › Grouping fields (like repeater field?!)
first, thanks for your amazing work!
I’m here to make a functionality/improvements suggestion related to something that happens frequently in my work using ACF (and other users).
Sometimes I have the need to create custom fields that will receive only small text information. And what we normally do is to create one or more text fields, and so on, resulting in a metabox with the various field lines.
In many cases, I prefer to group certain fields, making better use of horizontal space. For this, I end up using a resource that are provided by the ‘repeater field’ add-on: the table layout. So I define the minimum and maximum number of rows in 1, to prevent that the end user create new rows. I often go beyond the text fields, and use taxonomy fields, checkbox, or anything else.
The result is something that you already saw in others users posts, but I have another examples, just to illustrate..
I know that this is a recurrent feature request, but I think that we could use this new discussion to analyze the viabilities to make something easy and pratical.
My suggestion is to create a new field type: the ‘group field’ (something like the ‘tab field’ functionality, grouping all fields below it), where we could set the amount of columns for the group layout.
I don’t know how this field could work, but here is one simple idea:
this functionality could just add a wrapper-div for the fields below them (until a new group be defined), and each ‘in-field’ receives a inherit css propriety, based on the number of columns set for the group.
E.g.: If we set 3 columns for the group, the ‘in-fields’ could float left, each one with 33% (or a little less, based in one css template) of width. If we have 3 ‘in-fields’, they will be placed in one line. If we have 6 fields, 2 line … And we could also place groups inside groups..
If we don’t want more custom layout groups, just create a new one (to close the previous one) and keep the other fields as we already do.
Thanks for your time!
Thanks for the feedback,
Just to let you know, you can use CSS to float the fields and make them appear on the same line…
Perhaps I could add in a width option for normal fields?
That said, it would be very complicated to do this with sub fields due to the complicated table layout…
A good suggestion though, so thanks
My two cents:
We can already group fields using the repeater field as a container. And by setting minimum and maximum rows both to 1 the Add Row doesn’t even show.
But it’s a hack because we are forcing our data structure to be unnecessarily nested. A group layout field would be handy.
@dominic, this is exactly what I reported in my post 🙂
@augusto You are right. And I was agreeing with you.
I created something that attempts to create column fields similar to tab fields, although they don’t currently function as sub-fields it’d be great to get feedback on how to improve this addon.
Give it a go, https://github.com/WazzaJB/acf-field-column.
The topic ‘Grouping fields (like repeater field?!)’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.