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

feat!: implement FormField model, dataloader, and ConnectionResolver #416

Merged
merged 3 commits into from
May 26, 2024

Conversation

justlevine
Copy link
Member

@justlevine justlevine commented May 26, 2024

What

This PR:

  • Implements a new FormField model, which wraps the GF_Field object.
  • Implements a FormFields dataloader, for storing and caching our GF_Fields.
  • Refactors FormFieldsConnectionResolver to use AbstractConnectionResolver and the new model/dataloader.
  • Changed the GfFormField interface to implement the Node interface.

Why

Part of #298

How

  • FormField.id is no longer deprecated, and is now a global Relay ID.

Testing Instructions

Additional Info

  • Form/Entry -> FormField resolvers now pass the FormField model instead of the GF_Field object. While the model has been set up to pass-through to the underlying object, class checks (e.g. $source instanceof GF_Field ) will _no longer work and should be updated to the following:
...
'resolve' => static function( $source, array $args, AppContext $context, ResolveInfo $info ) {
-   if ( $source instance of GF_Field_Text ) { }
+   // use the underlying $source->gfEntry
+   if ( $source->gfEntry instanceof GF_FieldText ) {}
  ...
},

Checklist:

  • This PR is tested to the best of my abilities.
  • This PR follows the WordPress Coding Standards.
  • This PR has proper inline documentation.
  • This PR has unit tests to verify the code works as intended.
  • The changes in this PR have been noted in CHANGELOG.md

@justlevine justlevine force-pushed the feat/form-field-model branch from ca7dba0 to 81855b9 Compare May 26, 2024 08:46
@justlevine justlevine marked this pull request as ready for review May 26, 2024 09:02
@justlevine justlevine added the safe to test ✔ This PR can be run using repository secrets label May 26, 2024
@justlevine justlevine merged commit de8beb6 into AxeWP:develop May 26, 2024
32 of 35 checks passed
@justlevine justlevine deleted the feat/form-field-model branch May 26, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test ✔ This PR can be run using repository secrets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant