We’re completing the implementation of repeating field groups in Toolset. This will use the post relationship infrastructure, to make repeating fields super efficient. See how it’s going to look and give us your feedback.

For years, Toolset offered parent/child relationship, which we advocated as a good implementation for repeating groups of fields.

From the database point of view, this is OK, but our GUI implementation made it less than ideal to use. As part of our post-relationship project, we’re also creating convenient GUI to handle repeating sets of fields.

See how it’s going to work:

And, we got a lot of feedback that editing fields in narrow table is not always ideal. In fact, it’s also visible in our own video. So, we’re thinking about an alternative editing mode, which will display only one row for editing at a time.

Setting up repeating field groups

When you edit a fields group, you’ll see the usual button to Add new field. Next to it, you’ll find the new Add new repeatable group button. This adds a sub-group of fields.

Setting up a fields group with repeating groups in it

It’s not shown in the screenshot, but you can add repeating groups to repeating groups, providing infinite nesting.

Editing fields in a group

When you edit a post that has repeating fields group, it will look like this:

Nested repeating fields group in the post editor

You can add as many items as you need to any group. Click on ‘Create’ to add the first nested item or ‘Add new’ to add more items. Nested groups are tabulated under their parents.

This is how the ‘vertical-alignment editing mode for fields will look like:

Vertical-alignment editing mode, allowing to focus on one row at a time

Displaying repeating fields

You will be able to create a View that loops through a group of repeating fields. This way, you get full control over how the fields look. When you need to display a nested group, create a View for it and insert that View into the View of the parent group.

Including repeating fields in forms

CRED will provide a GUI that’s very similar to Types. You’ll be able to add items to the top-level group as well as to nested groups. Generally speaking, CRED gives you the same editing capabilities in the front-end as Types gives in the backend. This will be part of the CRED scaffold, so when you’re creating a form for a post that has repeating fields, you don’t need to manually create this complex data-entry.

How it works under the hood

In the GUI, there’s not much to do. You click a button to create a group of repeating fields and you add fields to the group.

Behind the scenes, Toolset uses child posts for the repeating items. This means that each field sits in a separate post-meta and not as part of a huge serialized array. By default, you never see the containers of the repeating fields. They appear to belong to the main post you’re editing.

Using separate post-meta for repeating fields allows Toolset to run efficient queries. In our example, we’ve created Universe > Planet > Country.

When you need to display all the planets that have a country by a certain name, it’s important to be able to run one query on the database and get these countries. If all this information is serialized into one post-meta, this query is impossible. With Toolset, it takes one efficient query on the database to get any post that you need. I hope that this makes sense.

Schedule

Our post relationship project has been “in development” for a long time and I’m guessing that it looks like it’s never going to complete 🙂

Actually, we’re just a few short weeks now from a first public release of Types.

Feedback?

Please tell us what you think about this new implementation, its GUI and workflow. We’re part-way through the implementation, so it’s a good time to get feedback and make adjustments.