
Advanced Custom Fields is now actively testing its new block creation feature in ACF 5.8 beta 1, released this week. ACF Blocks is a feature aimed at PHP developers who have not taken the deep dive into JavaScript yet. It essentially offers a shortcut to creating custom blocks using PHP and HTML instead of JavaScript.
“We believe that ACF Blocks is one of the more important features ever added to our plugin,” ACF representative Eric Karkovack said. “It levels the playing field and allows more developers to take advantage of Gutenberg’s key feature.” The feature was designed to allow WordPress developers who use ACF to maintain their current workflow for extending the editor.
ACF Blocks allows developers to register a custom block type from a functions.php file. From there they can create a field group and use any ACF fields in the block. Rendering the block is the same process that’s used for displaying custom fields, with the notable addition of wrapping the HTML + PHP in a function.
The ACF team plans to include the new blocks feature in version 5.8, which is anticipated to arrive in November.
Creating custom blocks in this way seems like a stopgap measure for developers who haven’t had the time to learn how to extend Gutenberg before WordPress 5.0 arrives. This feature may be a useful abstraction for those who need to maintain their current workflow with ACF but it postpones the inevitable for developers who want to be truly proficient at extending the new editor. JavaScript skills will be required to properly understand what is going on under the hood.
I started building some blocks with this beta version, it’s obviously buggy, but when done, it will be great.
– You can’t see the blocks html code.
– Any changes to any of the blocks attributes (parameters) and you will get “possibly not saved message”, even though the page/post is saved.
– The Additional CSS field in a block NEVER saves your custom CSS.
– Duplicating and item will result in having the duplicate item “under” the copied block if that makes any sense, so by moving the block upor down will then see the duplicated copy.
– Making a Block Reusable, which is a huge deal for Gutenberg, is a joke right now.
– Not having the ability to have separate rendering code for the backend and frontend, like the Lazy Blocks plugin, can be an issue in some cases. Elliot has to check out that plugin and incorporate some of its’ finer points.
And all these, with just about 3 hours of playing with it yesterday. Their support has not replied to me yet with all these issues, I’m sure they are busy. When everything gets fixed with ACF’s ability to have Accordions, Tabs, and the rest of unbelievable fields and features and options, the possibilities will be endless. The ability to do things with php, is a big plus for me.
Until yesterday, I was using “Lazy Blocks” to create my blocks, which is much easier to create blocks, but with ACF, you can do much, MUCH more.
Overall though, tools like this, I got converted from a Gutenberg hater, to a Gutenberg supporter, and very hopeful for the future and the potential of things to come. Very soon and just for the database bloat, doing things with custom fields will seem stupid, not to mention data migration issues with custom fields as oppose to json.