-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 0.3.0 doesn't work with PageLink, PostObject or Relationship fields #25
Comments
BTW this works perfectly on version 0.2.1, so I'm rolling back to using that version. |
Actually, I just noticed that in version 0.2.1 is very simple to query the fields inside a block using the Also, version 0.2.1 has a small bug which can be fixed by simply changing this chunk of code:
to this:
Otherwise, you'll get an error like this |
Hey, it's me again! So I was able to found the issue with v0.3.0 and I must say the fact that it uses the ACF plugin makes it work beautifully. The main issue was the way the filters are applied in the code, the class uses a Singleton approach that adds the filter during the instantiation of the class and the init action is applied to the init method of the class (which applies the singleton). The issue with that is that the filters are called only once and never again, so the filters are never called when the GraphQL tree/schema is built and thus we don't have the ACF fields inside the Gutenberg block. I made some changes to the code, for example, I remove adding the filters using the constructor and instead move them to the init function like this:
and modified the init function like this:
After doing those changes the plugin added the ACF fields to the Gutenberg block and everything else worked beautifully. |
I suspect I may have the same issue here, after installing wp-graphql-gutenberg-acf, No changes are made to the schema and I cannot see any fields when I drill into the ACF block. Can you share a full copy of the modifications you made to the file? |
@Dsmitheo sure, here's the full file:
|
Hi @pablo-tapia, would you be able to commit those changes into a PR? |
Sure, I'll get do that @pristas-peter |
This new version seems like it doesn't show the
acf
key anymore but rather display anattributes
property, trying to get the ACF field group data seems to happen through thedata
property that returns a JSON string. So far so good thedata
property shows all the fields declared inside the ACF Field Group.The problem is that when the field type is either PageLink, PostObject or Relationship the data showed only includes the Post/Page ID and nothing else. This query for example:
The resulting data looks something like this:
blog_posts
is a Relationship field and no matter if I choose to get the Post Object or the Post ID it always returns the ID. I need to get the data from the related Posts to display it on a page.Is my query wrong or is there a way for me to obtain the related Post data without having to execute a second query?
Any advice or guidance is greatly appreciated.
Thanks!
The text was updated successfully, but these errors were encountered: