Skip to content
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

Release v0.6.0 #262

Draft
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

jasonbahl
Copy link
Contributor

@jasonbahl jasonbahl commented May 13, 2021

WIP

This PR is a Work in Progress, but aims to solve quite a few issues with this plugin.

Breaking Changes

This PR includes many breaking changes, both to internal code APIs for users extending code via WordPress hooks/filters, etc and breaking changes to the shape of the Schema, so client applications will need to be adjusted to compensate for the changes.

Issues Addressed

This addresses the issues in the v0.6.0 milestone: https://github.com/wp-graphql/wp-graphql-acf/milestone/2

I'll be going through each issue and commenting/documenting how this PR resolves the issue.

…oned field groups

- deprecate class-config.php (will be removed for release)
# Conflicts:
#	src/deprecated-class-config.php
#	vendor/autoload.php
#	vendor/composer/autoload_real.php
#	vendor/composer/autoload_static.php
- Start adding PHPStan suggested fixes
- BREAKING: Changed some class names
…fix-field-group-prefixing

# Conflicts:
#	vendor/composer/InstalledVersions.php
#	vendor/composer/installed.php
…enting-other-groups-from-showing' into feature/fix-field-group-prefixing
Merge branch 'develop' into feature/fix-field-group-prefixing

# Conflicts:
#	vendor/composer/InstalledVersions.php
#	vendor/composer/installed.php
@ardiewen
Copy link

Understanding that this is still very much WIP, the major question that still remains open for me is how do we address reusability of ACF Fields on both the content editor side, as well as the graphql schema.

The following simplified use case will hopefully illustrate the need and the current gap in functionality.

Context / Use Case

As a layout builder, we've found great utility in building standalone field groups that address certain functions, then cloning them as needed. Here's a simplified / contrived example:

I've created a custom field group called Background with a single button group field called "Kind" which has options ["color", "image", "video"].

Screen Shot 2021-05-13 at 3 48 25 PM

We can then create our first section, called Banner and clone the entire field group using the All fields from... option.

Screen Shot 2021-05-13 at 3 52 49 PM

When we create addition sections such as Accordion, Carousel, Columns, in the future, any upstream changes to the Background field group will automatically be available on these

Currently, this is what we're observing on this PR branch:

  1. No prefixes are applied automatically to field groups when they're assigned using location rules.

    This is great! From our contrived example above, it means we can create a fragment like this:

    fragment BackgroundFields on Background {
      kind
    }
    
  2. When field groups are cloned however, they automatically inherit the parent type

    This becomes a challenge, as you'll get fragments like this:

    Screen Shot 2021-05-13 at 4 08 06 PM

    Which means we cannot reuse our fragment above:

    fragment BannerFields on Banner {
      background {
        ...BackgroundFields
      }
    }
    

    Ideally, we'd have a scenario in which we can clone the Background field group into multiple layout field groups, while reusing the same fragment above, like so:

    fragment BannerFields on Banner {
      background {
        ...BackgroundFields
      }
    }
    fragment AccordionFields on Accordion {
      background {
        ...BackgroundFields
      }
    }
    fragment CarouselFields on Carousel {
      background {
        ...BackgroundFields
      }
    }
    ...
    

I'm not sure how much of this is by design vs due to WIP status, but I thought I'd report some initial findings.

There's also a lot of this that hinges upon the design / intent of the clone field, I suppose.

Anyway, if there's anything else you'd like me to test, happy to make some more examples.

- add test for taxonomy field in repeaters
- add test for repeater field with no values saved
- all tests passing. . .still need to work on Clone fields, Flex Fields, and re-usable interfaces/fragments. . . and need to clean up code quite a bit
- Add initial work to open Field Group as a Fragment in GraphiQL (in progress, but shows where in the Schema Field Groups will show in the Field Group posts table)
- Add helper function `get_parent_type_fields_interface()` to AcfField.php
- Update fields/FlexibleContent.php to register Layout Interfaces and return the Flex Field type as a list of the Layout Interface
- Update Connection Fields to use the Field Group Interface type as the to-type instead of the Field Group Object Type
- Add a complex field group export for tests
- Add initial tests for Settings (testing the fragment generation)
- Add initial tests for ComplexFlexAndCloneFields
…r own files.

No changes to the content of the docs, just organization of the docs.
…fixing

# Conflicts:
#	docs/fields/accordion.md
#	docs/fields/button-group.md
#	docs/fields/text.md
- run `composer install --no-dev`
@kidunot89 kidunot89 self-requested a review October 21, 2021 16:29
@gavinhenderson
Copy link

Hey @jasonbahl @kidunot89 Is there any plan to release this new version?

If there is anything that I can contribute to help you be able to launch this let me know. I am very appreciative of all your work!

I am in need of some of the fixes in this new version to allow me to access relationship fields that is a list.

@jasonbahl
Copy link
Contributor Author

@gavinhenderson I'm hoping to get back to it soon, but I can't promise an ETA as there's a lot of other in-flight work I'm doing.

@jasonbahl
Copy link
Contributor Author

But feel free to use this branch in your environments if it works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment