Hello! I’ve been playing around with ACF’s solution to custom Gutenberg blocks and I love the flexibility… however I’m having trouble figuring out how to allow other blocks to be used inside.
For example, I want to create a simple container block which allows for customizing the background, padding, etc. for any other block (like an image or paragraph, for example).
All I could find was this… any idea on how to hook it up with ACF’s method?:
This was already suggested to Elliot on Github, and the answer we got back was that this is something he is going to look into later on, once he finishes v5.8 I guess…
Personally, and for the time being, any container needs that I have for, like sections, tabs, etc… are put on hold, except one, called “section”, where I wrap a WYSIWYG field with the container code, and as a compromise for now, I will be using shortcodes that my theme and plugins provide to populate the content of that section. Not an ideal solution, but that’s the best I could do until ACF allows inner blocks, and my guess is that this has to be a new field type that needs to be created…
Anyone else willing to share their solutions regarding this issue, will be greatly appreciated, at least by me…
Just chiming in to add my support for adding Inner Blocks as a feature for ACF Blocks! I’m looking to use blocks to create sections, too. This would be immeasurably useful. I’ll keep playing around on my own, and if I come up with any better alternatives, I will post them here.
I ran into this issue as well for a general wrapper block with default options, ACF support for innerblocks would be awesome!
Yes, please! The plugin won’t reach its potential until this is implemented.
Oh, I can see I’m not the only seeking desperately for a way to get a wrapper in ACF block!
I hope it’ll be soon implemented ’cause this feature could really get ACF to the highest levels!
Go Elliot Go!!! 🙂
Much needed feature, glad to see I’m not alone in wanting this.
Honestly I’m surprised Gutenberg didn’t ship with a row/container block. Good thing we have ACF and Elliot to save us! 😉
I’d really love to see this feature! Everything else is working great. If anyone finds a workaround in the mean time please share.
FWIW, this is admittedly very very hackish, but the way I’ve been handling this until a better solution comes in is to create a custom block (called “Section”) which has an option to set to either open or close. I then put that block before and after (set to “open” and then “close” respectively) the blocks I want to “wrap” in a section container. Then in the block template I simply render either an opening HTML tag or a closing HTML tag. I also add additional (conditional) fields to set background colour/padding and other customizable things.
Chiming in here, I would LOVE to see this. To have a container block using ACF’s super straightforward registration function would be amazing. If Gutenberg coding didn’t scare me so much, I’d try my hand at creating a very simple container block, just to have something…
Ok so I got a reply from Elliott on this.
Basically, he sees no possible way to add InnerBlock capability to a dynamically-generated block.
As you would know, all ACF blocks have to be degnerated dynamically, and as such there are limitations on what can be done, and to his mind, InnerBlocks can’t be done.
He’s open to what others may know beyond that, but frankly, that’s a little scary! I can’t see a rock solid solution if we can’t do this. There are so many applications that really need it, to my mind.
So I guess, thinking caps on, people!!
Absolutely necessary feature…
While waiting, I used “create-guten-block” from https://ahmadawais.com/create-guten-block-toolkit/ to make a “parent” block. For now it works great, some small admin bug with UI (paragraph go over the “+” add block button) but it saves me some times for now!
Just an update that it is 100% possible to create a dynamic block that allows inner blocks. Maybe it wasn’t in the earlier stages but I can confirm it works.
I’ve already let Elliot know and I really hope he can get this in 5.8. It seems very simple since ACF blocks beta already has everything else in place.
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
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2019 Advanced Custom Fields. Subscribe