This is a bit of rabbit hole but I’m hoping someone has trod this way before. I am using Flexible Content to offer the Editor access to a number of Blocks (think Gutenberg but ACF). Most of these blocks are content blocks and I can give them an intelligent title ‘Text Block’, ‘Heroes’ etc. but in order to insert preformed blocks in the run of the page I have a Layout called ‘Block Selector’ in which the Editor can choose from a Select; ‘Contact Form’, ‘Team’ etc.
When the Layouts are collapsed, they all show the Layout Name
What I would like to do is append the Selection (which is the value of the first (Select) field in the layout) to the title “Block Selector”, so “Block Selector: Contact Form” etc.
Can anyone point me at the hook where I can get into the Layout Title?
You would have to loop over all of the layouts in the flex field to populate the select field.
I can’t give you any help on dynamic population would work as new layouts are created, not something I’ve ever tried before. But it would involve creating a JS action that triggers when a layout is added or when the field you’re basing it on changes and then writing JS to update the select field(s) choices.
Targeting events on ACF fields would look something like
$('[data-key="field_XXXXXXX"] .acf-field select')
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Clients need flexibility. Developers need a repeatable workflow that doesn’t have a steep learning curve. See how digital marketing agency Noiza found both with Advanced Custom Fields in our latest case study.https://t.co/BxQAy6COJt