After reading this post about the release of the first Gutenberg-compatible ACF version (beta) https://www.advancedcustomfields.com/blog/acf-5-8-introducing-acf-blocks-for-gutenberg/, I played with it and tried to reduce the work to create a custom block to the minimum.
I wrote an article about it here (sorry it’s in french): https://medium.com/nicooprat/acf-blocks-avec-gutenberg-et-sage-d8c20dab6270
The idea is to be able to create a bloc like we’re used to create a custom template: just create a file with the right name in the right folder, and with the right meta datas as PHP comments.
I got it working by adding this in my theme: https://gist.github.com/nicooprat/2c1a642d102425d3131037e5dc156361
Then I was able to create a new bloc in
views/blocks like this: https://gist.github.com/nicooprat/767973a9a4bd2b3758e527caf4a25dd6
It’s not battle tested as I just discovered it yesterday, but it looks like there’s no limitation in use by doing that. I’m sure the code can be improved though!
What do you think?