StoutLogic / acf-builder

An Advanced Custom Field Configuration Builder
GNU General Public License v2.0
790 stars 61 forks source link

ACF Builder + Sage ACF Gutenberg Blocks data not being passed #138

Open sunsuron opened 3 years ago

sunsuron commented 3 years ago

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

Bugs? Am I missing something? Advice please...

stevep commented 3 years ago

@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.

stevep commented 3 years ago

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?

sunsuron commented 3 years ago

@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:

FireShot Capture 271 - pma _ localhost _ mfw _ wp_postmeta - phpMyAdmin 5 1 1 - pma

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

scf

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!

stevep commented 3 years ago

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/

sunsuron commented 3 years ago

@stevep

Nice! Thank you very much for the link. It definitely helps!

Log1x commented 3 years ago

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).

sunsuron commented 3 years ago

@Log1x

You're right! Thank you for pointing that out...