– Timber Library (mu-plugin)
– ACF Pro 6.x (mu-plugin)
– ACF Blocks
– Render via
'render_callback' instead of
– Timber (Gutenberg) Blocks
There’s another thread over at https://support.advancedcustomfields.com/forums/topic/register-block-preview-image-with-acf_register_block_type/#post-146180 which allows support using the
acf_register_block_type() function for a generic image.
In pre-6.x, this approach was working perfectly to just display a preview image (instead of prepopulating content via ajax, which never really worked).
After converting my block to
block.json, still using the same custom
render_callback, I can’t seem to get it to load the preview.
I tested with a bit of poor-person’s debugging and its not loading the custom
render_callback at all and just ‘spins’ the loading icon while dropping an error via
Uncaught TypeError: n.jsx is undefined from
Am I approaching it wrong? I’m trying to avoid using a specific
RenderTemplate because TWIG/Timber IS renders the templates itself. Our current setup ‘scans’ each directory in
blocks/, grabs the associated PHP file, and loads the
register_block_xx function from there, so I am really hoping the solution does not require one PHP file as the “plugin” and another as the “template”.
6.x incompatibility with the existing Timber instructions of leveraging the custom
render_callback? (See https://timber.github.io/docs/guides/gutenberg/#how-to-use-acf-blocks-with-timber )
Not really a bug, per say, since its literally stacking Timber on top of Gutenberg on top of ACF, but it WAS working. Thus, the open question! ^-^ (Also not really sending as a bug, to give reference for other Timber developers! ^-^ )
I am having a similar issue and wrote about it at https://support.advancedcustomfields.com/forums/topic/acf-6-block-json-data-in-template-fails-to-load/ . Did you ever work this out?
Yeah, that exact filename is also needed , but that was correct. Perhaps I did not build properly at the time. However, in the end I decided to go full ReactJS/ Blocks and leave out ACF for this block. And that works now. Thanks for the feedback though @tjhole-support !
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!