Home › Forums › Add-ons › Flexible Content Field › Modify flexible content block options on the fly › Reply To: Modify flexible content block options on the fly
Is it sub fields in a layout that you want to add or do you want you want to add additional layouts.
If it is the latter, adding layouts, this would be done better by removing layouts. You would create these layouts and they would be part of the flex field. Then you would create an acf/load_field filter, loop over the layouts and keep them or remove them based on what is being edited. I posted an extremely basic example of doing this here https://support.advancedcustomfields.com/forums/topic/disable-layout-from-showing-in-template/
Adding additional fields would be more problematic. In this case you’d need to add these fields using PHP https://www.advancedcustomfields.com/resources/register-fields-via-php/. Although, you could probably use the same removal method as above but you’d need to loop over all of the fields in each layout as well and remove them.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.