Support

Account

Home Forums Gutenberg How to allow Inner Blocks with ACF in Gutenberg Reply To: How to allow Inner Blocks with ACF in Gutenberg

  • Hi everyone,
    just wanted to chime in and tell you that I’ve managed to use ACF with innerblocks. My use case is a “Text” Block which wrapps all other textish blocks (paragraph, heading, list) for a common wrapper (container, margins/paddings – all design reasons).
    I’m using this helper methods and the editor.BlockEdit und blocks.getSaveElement hooks to overwrite the save & edit components of acf blocks. You can see it in this gist.

    It’s kinda hacky, works only until ACF 5.8.2 (have to find out what’s breaking it in 5.8.3). But with mode set to preview, the fields only showing in the sidebar and some styling I managed to get it working for editors/normal users.

    I’m also working on adding custom fields to core blocks – have a proof of concept which adds fields to core/paragraph but not saving correctly atm. If anyone wants to help/the code I’ll set it up as a github repo.