v0.4.0 - A Simpler Form Submission Flow!
**
This release adds the submitGravityFormsForm mutation that submit forms without needing to use the existing createGravityFormsDraftEntry -> updateDraftEntry{fieldType}Value -> submitGravityFormsDraftEntry flow.
Similarly, we've added support for updating entries and draft entries with a single mutation each, and added support for using form and entry IDs in queries - without needing to convert them to a global ID first. We also deprecated fields in favor of formFields, so there's less confusion between GF fields and GraphQL fields.
Also, we made several (breaking) changes to streamline queries and mutations: many GraphQL properties have been changed to Enum types, and formFields (and the now-deprecated fields) are now an interface. This should make your queries and mutations less error-prone and (a bit) more concise. We're also now using native Gravity Forms functions wherever possible, which should help ensure consistency going forward.
Beyond that, we've squashed some bugs, deprecated some confusing and unnecessary fields, and refactored a huge portion of the codebase that should speed up development and improve code quality in the long term.
New features
- Added
submitGravityFormsFormmutation to bypass the existing draft entry flow. See README.MD for usage. - Added
updateGravityFormsEntryandupdateGravityFormsDraftEntrymutations that follow the same pattern. - Added
idTypetoGravityFormsFormandGravityFormsEntry, so you can now query them using the database ID, instead of generating a global id first. - Added
idproperty toFieldErrors, so you know which failed validation. - Deprecated the
fieldsproperty onGravityFormsFormandGravityFormsEntryin favor offormFields. - Support cloning an existing entry when using
createGravityFormsDraftEntryusing thefromEntryIdinput property. - Converted all Gravity Forms
formFields(and the now-deprecatedfields) to a GraphQL Interface type. That means your queries can now look like this:
query {
gravityFormsForms {
nodes {
formFields {
nodes {
formId
type
id
... on AddressField {
inputs {
defaultValue
}
}
... on TextField {
defaultValue
}
}
}
}
}
}- Switched many field types from
StringtoEnum: AddressField.addressTypeButton.typeCaptchaField.captchaThemeCaptchaField.captchaTypeCaptchaField.simpleCaptchaSizeChainedSelectField.chainedSelectsAlignmentConditionalLogic.actionTypeConditionalLogic.logicTypeConditionalLogicRule.operatorDateField.calendarIconTypeDateField.dateFormatDateField.dateTypeEntriesFieldFilterInput.operatorEntriesSortingInput.directionForm.descriptionPlacementForm.labelPlacementForm.limitEntriesPeriodForm.subLabelPlacementFormConfirmation.typeFormNotification.toTypeFormNotificationRouting.operatorFormPagination.styleFormPagination.typeGravityFormsEntry.fieldFiltersNodeGravityFormsEntry.statusNumberField.numberFormatPasswordField.minPasswordStrengthPhoneField.phoneFormatRootQueryToGravityFormsFormConnection.statusSignatureField.borderStyleSignatureField.borderWidthTimeField.timeFormatvisibilityProperty- FieldProperty:
descriptionPlacement - FieldProperty:
labelPlacement - FieldProperty:
sizeProperty
Bugfixes
SaveAndContinuenow usesbuttonTextinstead of theButtontype.lastPageButtonnow uses its own GraphQL type with the relevant fields.- The
resumeTokeninput field on thedeleteGravityFormsDraftEntry,SubmitGravityFormsDraftEntry, and all theupdateDraftEntry{fieldType}Valuemutations is now a non-nullableString!. - When querying entries, we check that
createdByIDis set before trying to fetch the uerdata. - Where possible, mutations and queries now try to return an
errorsobject instead of throwing an Exception. - We've added more descriptive
Exceptionmessages across the plugin, to help you figure out what went wrong. - We fixed a type conflict with
ConsentFieldValue.valuenow returns aStringwith the consent message, ornullif false. - Deprecated
urlin favor ofvalueonFileUploadFieldValueandSignatureFieldValue. - Deprecated
cssClassListin favor ofcssClass. - The
resumeTokeninput field on thedeleteGravityFormsDraftEntry,SubmitGravityFormsDraftEntry, and all theupdateDraftEntry{fieldType}Valuemutations is now a non-nullableString!.
Under the hood
- Refactored Fields, FieldValues, and Mutations, removing over 500 lines of code and improving consistency across classes.
- Switch to using
GFAPI::submit_form()instead of local implementations for submitting forms and draft entries. - Implemented phpstan linting.
- Migrated unit tests to Codeception, and started backfilling missing tests.
- Updated composer dependencies.