ACF Builder + Sage ACF Gutenberg Blocks data not being passed
Hi all,
I am using ACF Builder + Sage ACF Gutenberg Blocks from orditeck/sage9-acf-wp-blocks.
All is well until I realized data from the block seems not being passed to the controller or filter.
I have done a screencast so that you guys can understand what I meant.
Part 1: https://sunsuron.com/sage-acf-builder-wo-block.webm Part 2: https://sunsuron.com/sage-acf-builder-w-block.webm
-
video
-
after fresh bedrock + sage installation:
- change theme to Sage
- configure permalinks
- install & activate ACF Pro
- create Products group and a 'price' field in dashboard
- created a Products controller + its template
- pass the 'price' data
- create Products filter
- pass the 'price' data
-
install acf builder
-
install acf block
-
configure acf builder to read & register all php files inside '/app/fields/blocks/'
-
create ACF block with one form input: 'title'
-
attach 'title' ACF block into Product page
-
publish
-
-
observation
- 'title' is NULL
-
expectation
- 'title' should equal to 'This is a title inside an ACF block'
Bugs? Am I missing something? Advice please...
@sunsuron
Thanks for the detailed screen captures.
I can't say I have much experience with Blocks, let alone using ACF and ACF Builder with blocks.
Are you able to look in the database, and look at the post meta table, and all the meta key and values for that post ID (7 in the video)? Is there a meta value "This is a title inside an ACF Block"? what is the meta key? That might help debug this issue.
Hm, or actually blocks don't use post meta do they? The content gets stored in the post's content field right? Can you take a look there and let me know what you see?
@stevep
Thanks Steve for the prompt feedback!
I've checked and it seems only the 'price' field was saved. Here's a screenshot from the wp_postmeta table:

Here's the result from wp_posts. You are right, it is saved in here.

But I don't know the significant of this findings actually. Should it be saved in wp_postmeta or in wp_posts?
I just checked and I can get the $post object though. Do I need to manually parse the post_content in order to get the 'title'?
Thanks!
Yes blocks get stored in the post_content on posts, so that is correct. It looks like you do have to parse the blocks in the post's content to get the raw values.
This is from my quick google search so maybe there are better ways but check out: https://support.advancedcustomfields.com/forums/topic/acf-5-8-parse-gutenberg-blocks-and-get-acf-data-outside-of-post/
@stevep
Nice! Thank you very much for the link. It definitely helps!
Just a sanity check, are you using the wrong package? You mentioned orditeck/* but I believe that is just a temporary fork for a pull request.
You'd be looking for https://github.com/MWDelaney/sage-acf-wp-blocks which is 46 commits ahead of the fork and may have this fixed (haven't personally used this, though).
@Log1x
You're right! Thank you for pointing that out...