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: Refactor FormField registration #273

Merged
merged 7 commits into from
Jul 28, 2022

Conversation

justlevine
Copy link
Member

@justlevine justlevine commented Jul 7, 2022

What

This PR refactors the way that individual FormField objects are registered to WPGraphQL.

The goal is to:

  • Optimize the registration lifecycle to make it easier to grok and extend.
  • Use interfaces for FormField settings.
  • Generate simplified field choices, inputs, and fieldValues.

Why

How

  • feat: refactor GfFormField to use interfaces.
  • dev!: remove PropertyMapper, ChoiceMapper, InputMapper, and FieldProperties classes. in favor of the FormFieldRegistry, FieldInputRegistry and FieldChoiceRegistry classes.
  • dev!: move TypeRegistry classes to WPGraphQL\GF\Registry namespace.
  • dev!: remove nullable $type_registry param from Registrable::register() interface method.
  • dev!: remove the $type_registry param from the graphql_gf_after_register_types and graphql_gf_before_register_types actions.
  • dev: add following actions: graphql_gf_after_register_form_field, graphql_gf_after_register_form_field_object, graphql_gf_after_register_form_field_choices, graphql_gf_after_register_form_field_inputs.
  • dev add the following filters: graphql_gf_form_field_setting_choice_fields, graphql_gf_form_field_setting_input_fields, graphql_gf_registered_form_field_setting_classes, graphql_gf_registered_form_field_setting_choice_classes, graphql_gf_registered_form_field_setting_input_classes.
  • dev: deprecate the graphql_gf_form_field_setting_properties filter in favor of graphql_gf_form_field_setting_fields.
  • dev: deprecate the graphql_gf_form_field_value_properties filter in favor of graphql_gf_form_field_value_fields

Testing Instructions

There are no breaking schema changes.

Additional Info

Checklist:

  • My code is tested to the best of my abilities.
  • My code follows the WordPress Coding Standards.
  • My code has proper inline documentation.
  • I have added unit tests to verify the code works as intended.

@justlevine justlevine added type: enhancement ⚡ Improves on an existing feature status: in progress 🚧 Work on this has begun labels Jul 7, 2022
@justlevine justlevine force-pushed the feat/form-field-actions branch 2 times, most recently from 4b053a0 to da953f2 Compare July 12, 2022 19:33
@justlevine justlevine mentioned this pull request Jul 12, 2022
4 tasks
@justlevine justlevine force-pushed the feat/form-field-actions branch 2 times, most recently from 032fbb7 to f4c550b Compare July 21, 2022 11:25
@justlevine justlevine marked this pull request as ready for review July 28, 2022 00:55
@justlevine justlevine merged commit 22766c0 into AxeWP:develop Jul 28, 2022
@justlevine justlevine deleted the feat/form-field-actions branch July 28, 2022 01:34
justlevine added a commit that referenced this pull request Aug 12, 2022
* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps
justlevine added a commit to justlevine/wp-graphql-gravity-forms that referenced this pull request Aug 17, 2022
* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps
justlevine added a commit that referenced this pull request Aug 17, 2022
* dev!: Register GraphQL types individually (#276)

* chore: restore Hookable interface

* chore!: use register_hooks() for type registration

* Feat: Refactor FormField registration (#273)

* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps

* dev: add get_type_name() to input and choice registry

* feat: add connected input/choice to checkbox field value

* chore: add var tag
justlevine added a commit to justlevine/wp-graphql-gravity-forms that referenced this pull request Aug 17, 2022
* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps
justlevine added a commit to justlevine/wp-graphql-gravity-forms that referenced this pull request Aug 19, 2022
* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps
justlevine added a commit to justlevine/wp-graphql-gravity-forms that referenced this pull request Aug 28, 2022
* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps
justlevine added a commit to justlevine/wp-graphql-gravity-forms that referenced this pull request Aug 29, 2022
* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps
justlevine added a commit that referenced this pull request Aug 30, 2022
* Feat: Refactor FormField registration (#273)

* feat!: refactor form field settings to use interfaces

* feat!: refactor form field choice and inputs to use interfaces

* chore: cleanup

* chore: rename types

* chore: cleanup filters

* docs: add new actions/filters

* chore: update composer deps

* fix: remove duplicate $ignored_field values.

* fix: use the correct GF_Field for child types with their own classes

* chore: order value methods alphabetically

* feat: graduate product Field (query)

* feat: gradiuate `option`, `price`, `quantity`, `shipping`, and `total` fields (query

* fix: set fallback product quantity to 1

* fix: change quantity GraphQL type to float

* chore: fix composer deps post rebase

* feat: add Product mutation support

* feat: add price and formattedPrice to QuantitySelectFieldChoice

* tests: quantity field tests

* fix: docblock headers

* test: reset $_gf_state by setting to empty array

* fix: option choice type name should resolve to OptionFieldChoice

* test: option field tests

* test: shipping field tests

* fix: use updated entry when preparing values for save

* feat: add support for total field

* test: lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in progress 🚧 Work on this has begun type: enhancement ⚡ Improves on an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant