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

Conversation

rsm0128
Copy link
Contributor

@rsm0128 rsm0128 commented Jan 19, 2021

  1. Added Explicit options for adding ACF Field Groups to the Schema
  2. Added explicit option auto-generation code for plugin upgrade from older versions.

@rsm0128 rsm0128 changed the base branch from master to develop January 19, 2021 16:22
@jasonbahl
Copy link
Contributor

@rsm0128 This is a great PR! I'll review it in detail shortly!

Thanks for working on this 🙏

acf_render_field_wrap(
[
'label' => __( 'GraphQL Types to Show the Field Group On', 'wp-graphql-acf' ),
'instructions' => __( 'Select the Types in the WPGraphQl Schema to show the fields in this fiedl group on', 'wp-graphql-acf' ),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error. Should be field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the spelling. Thanks

@drewbaker
Copy link

Excited to see this working!

@Xedecimal
Copy link

I checked this branch out and tested it. With this you could pick something like Category (taxonomy), but you couldn't pick a specific category for it to show on. Also in WooCommerce, productCategory has the same name as regular post categories so they both show up here as Category (taxonomy).

I don't think this solves the issue of being able to iterate over all available field groups for a given type. I'm thinking you have a store and products in a given productCategory have a series of field groups that could be applied to products inside a given category, or to all categories store-wide. We don't want to hunt for a set of specific names every time we load a product category but to simply get all of the field groups that apply to this context (viewing a category, or viewing any product), then we could show all of them.

This does solve the problem of specifying multiple Location conditions not being shown at all ever. I could apply a complex ACF Field Group to all categories and they would show up everywhere with this.

@drewbaker
Copy link

So the idea is that you opt into what TYPEs you want the field group to be on (as that is how the GQL schema works) and then you'd use the ACF location filters (and their existing API) for dictating where the field groups show up. This should allow you to say "I want this field group on CATEGORIES but only show up on the category called CARS). Does that help?

@Xedecimal
Copy link

I think my request is outside the scope of this fix. This does allow items to show up when you specify multiple locations. My request is more along the lines of getting an array of all the field groups and properties that apply to a given item. Which is currently not possible with the layout of wp-graphql-acf in general. You would need to know each name of each property you are asking for in graphql, of which I would need a more generic list of edges and nodes for all groups and all fields that apply to an item like a category. I've started developing a resolver to get edges for all fields but it's getting more and more complex. Namely there's no good generic way to specify all different types of fields as of yet. I would say this PR is good and works for what it's meant to.

@intelligence
Copy link

Thanks for this, with my limited testing, it works well!

@drewbaker
Copy link

@rsm0128 I spoke with @jasonbahl and he'd like to get some test coverage for this PR. Can you do that (obviously I'm happy to pay for it). Any questions on setting up the tests, ask here. Thanks!

@rsm0128
Copy link
Contributor Author

rsm0128 commented Mar 5, 2021

Thanks @drewbaker !
@jasonbahl Could you guide me on setting up the tests? @drewbaker is eager to see this PR be merged soon!
So I'm willing to assist you on this.

@rsm0128
Copy link
Contributor Author

rsm0128 commented Mar 15, 2021

@jasonbahl @drewbaker
By mistake, I created this PR from master branch of my fork, and it made it hard to check and update new commits.
So I created another PR from my fix branch.

@rsm0128 rsm0128 closed this Mar 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants