Hey guys!
We built a couple of developer tools and I thought I’d share them with you.
Over the last years, we at Codelight have been gravitating towards building sites more and more using ACF Flexible Content. Giving the client a way to put together new page layouts using existing pieces is really useful and reduces the amount of boring work. In addition to that, organizing the code by blocks rather than templates makes much more sense since usually many elements between templates overlap.
To simplify the process, I’ve built a library that abstracts away all the “plumbing” and lets you focus on writing just the site-specific code. I ended up with a system where you can define blocks either via simple procedural code or clean OOP classes and re-use blocks between templates and flexible field groups super easily. We’ve battle-tested it on quite a lot of projects by now and it works perfectly (at least for us), saving tons of dev time. I personally find that it fits many situations much better than using soberwp/controller. We also have a system for defining block-specific JS modules that are automatically executed if the block exists on page, but we haven’t had the time to publish it yet.
You can find the code and a couple of examples here: GitHub - codelight-eu/acf-blocks - haven’t had much time to write documentation yet, but it’s a start.
One more thing. The biggest problem with ACF Flexible Content is usability in admin. It can be difficult for site admins to get a good overview of the elements on the page. So we solved that by moving the flexible layouts to vertical tabs which can be drag-n-dropped to re-order them. For that, we built a plugin - check it out here: GitHub - codelight-eu/acf-tabbed-flexible-content
Hope this helps someone. All feedback welcome!