MWDelaney / sage-acf-wp-blocks

Composer library for generating ACF Gutenberg blocks from templates. Intended for use with Roots/Sage (http://roots.io)
346 stars 66 forks source link

Register block data filter #40

Closed cfaria closed 4 years ago

cfaria commented 4 years ago

In order to create ACF blocks with innerBlocks Gutenberg functionality I need to filter the $data array to add an entry named has_inner_blocks. I'm following this gist https://gist.github.com/gaambo/633bcd83a9596762218ffa65d0cfe22a and it works like a charm, but I need to show inner blocks in the editor inside ACF HTML output.

With this change I can call the hook to add $data['has_inner_blocks'] = true; for that container block. I'm doing sth like @terence1990 comment here: https://gist.github.com/gaambo/633bcd83a9596762218ffa65d0cfe22a#gistcomment-3182473

Code tested and works but change the hook name as you want ;D

cfaria commented 4 years ago

The other way to solve this is to create functionality to have the has_inner_blocks var in the Sage block view file headers. But as this is not a default functionality I think it's better to add it with that new hook.

cfaria commented 4 years ago

Hi Michael ;D. Would you mind check this out? Won't bother you again... Thank you!!