Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Add Explicit options for adding ACF Field Groups to the Schema #135

Closed
jasonbahl opened this issue May 5, 2020 · 13 comments · Fixed by #229
Closed

Add Explicit options for adding ACF Field Groups to the Schema #135

jasonbahl opened this issue May 5, 2020 · 13 comments · Fixed by #229

Comments

@jasonbahl
Copy link
Contributor

Currently, the way WPGraphQL for ACF implicitly maps field groups from ACF Location Rules to the WPGraphQL Schema causes a lot of confusion.

ACF has a lot of location rules that require specific run-time context that's not available for Schema generation.

For example, rules such as Page is not equal to Home or Post is equal to Hello World don't exactly map well to a Schema.

The Schema is representative of all Types available, and context such as whether a Page is the Home Page, or a Post is the "Hello World" post is runtime context.

So, in an effort to reduce this confusion, I'm working on a more explicit setting where you can define the GraphQL Types to show the ACF Field Group on, and not rely on the location rules at all.

The location rules can be used for determining the editing experience, and the new setting can be used for determining explicitly which Types the field group should be available on in the Schema.

Something like the following:

Screen Shot 2020-04-20 at 1 56 00 PM

This checkbox field will show all Types that can have field groups associated with them. Post Types and Taxonomies that are exposed to GraphQL, Users, Comments, Menus, Menu Items, Media, Page Templates, etc.

@AbeCole
Copy link

AbeCole commented May 5, 2020

Looks good, definitely separating the 'display' logic of locations rules from the 'filtering' logic of what is/isn't added to the schema feels more correct

@rburgst
Copy link

rburgst commented Jun 9, 2020

when can we expect this to be implemented?

@willem-aart
Copy link

Would love to see this happen 😃👍🏻

@supriome
Copy link

How's the development of this feature coming along?

@AbeCole
Copy link

AbeCole commented Jul 21, 2020

How's the development of this feature coming along?

Not sure myself, but if you want a quick workaround take a look at #134

@magicspon
Copy link

Any updates on this?

@ledniy
Copy link

ledniy commented Sep 25, 2020

@jasonbahl sorry for tagging you, but do you plan to complete it? It's a deal breaker for me to use new gatsby wordpress source and wp-graphql, because my WP admin dashboard build on top of location rules and users see only what they can add for specific pages/types/categories. So the separation from location rules is very important in my case. Thanks in advance.

@supriome

This comment has been minimized.

@AbeCole
Copy link

AbeCole commented Sep 28, 2020

@supriome Just to say the 'workaround' solution I provided will still 'work'. It does have 2 caveats: (1) The acf field groups will appear on more objects than they should (2) You can't have 2 field groups with the same 'GraphQL name'

@supriome
Copy link

@AbeCole Thanks again, I'll try this method on my next project. But for now, my solution is to get the data through REST API instead of using GraphQL

@rsm0128
Copy link
Contributor

rsm0128 commented Jan 19, 2021

I created a PR to handle this issue.

@abdulrauf11
Copy link

Any updates on this? This issue seems to be a deal-breaker when it comes to building client projects.

@AbeCole
Copy link

AbeCole commented Jan 25, 2021

Any updates on this? This issue seems to be a deal-breaker when it comes to building client projects.

Look at the PR @rsm0128 mentioned, seems to be progress happening there, but nothing completely merged to main branch yet

jasonbahl added a commit that referenced this issue Apr 20, 2021
Fix #135. Add Explicit options for adding ACF Field Groups to the Schema
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.