Ever wondered if it was possible to add an ACF Repeater as the source for – for example – an Accordion module? Well.. you can. Here’s how:
There are a few things you need to do in preparation:
- Set up the a repeater-field with it’s subfields on the page, post or CPT
- Add a connections parameter to the Accordion
- Create a filter for the Toolbox Connector, specifically for the repeater
Step 1: set up the repeater-field
Add a Repeater field to your page, post or CPT. When you add the subfields, make sure they have a name that matches the fieldsnames used by the Accordion Module. In this case they should be ‘label’ and ‘content’. Don’t get confused by the “Label” for the Sub Fields, which could by whatever you want. make sure to save it.
Step 2: Add connections parameter
make sure you activated the ‘extra connection for the modules’ on your Toolbox Settings page in the dashboard. If you do, the connections option will be activated by the plugin.
Step 3: Create filter
This is the most interesting part of course. With just a tiny amount of code you can tell the plugin to return the subfields the way Beaver Builder expects it.
And that’s it! This filter gets a very high priority (90 so that it runs late) so that any other filter can return a value if that’s what we want and we escape early. So now, if for some reason you DON’T select a subfield in the repeater-connector you can just pass on the whole repeater as objects, Which the Accordion Module uses as the items-list.
Just look at the video to see what that may look like.