Releases: AxeWP/wp-graphql-gravity-forms
v0.6.1 - Bugfix
- Fixes a fatal error when adding support for new fields with the
wp_graphql_gf_field_typesfilter.
v0.6.0 - Gravity Forms v2.5 Support
This release adds support for all the new goodies in Gravity Forms v2.5, squashes a few bugs related to Captcha fields, and refactors the InputProperty on various form fields.
New Features
- Added
customRequiredIndicator,markupVersion,requiredIndicator,validationSummaryandversiontoGravityFormsFormobject. - Added
layoutGridColumnSpanandlayoutSpacerGridColumnSpantoformFieldsinterface. - Added
enableAutocompleteandautocompleteAttributetoAddressField,EmailField,NameField,NumberField,PhoneField,SelectField, andTextField. - Added
displayOnlyproperty toCaptchaField. - Added
allowedExtensionsanddisplayAltproperty toPostImageField. - Added
sortargument for filteringRootQueryToGravityFormsFormConnection. Note: Attempting to sort on GF < v2.5.0.0 will throw aUserError.
Bugfixes
- [Breaking]: Fixed the
captchaThemeenum to use the correct possible values:lightanddark. captchaThemeandcaptchaTypenow correctly returnnullwhen not set by the field.- The
captchaTypeenum now has a default value ofRECAPTCHA.
Under the hood
- Refactor various
InputPropertyclasses.InputDefaultValueProperty,InputLabelProperty, andInputplaceholderPropertyhave been removed for theirFieldPropertycousins, andEmailInputPropertyis now being used forEmailField. - Tests: Clear
GFFormDisplay::$submissionbetween individual tests. - Tests: Allow overriding the default field factories.
- Tests: Add tests for
CaptchaField.
v0.5.0 - Add Gatsby Support, Email Confirmation, and more!
**
This release moves entry.formField values from edges to nodes, slimming down the query boilerplate and making the plugin compatible with gatsby-source-wordpress. We also added support for submitting an email confirmationValue and retrieving PostImage values, squashed a few bugs, and made the wp_graphql_gf_can_view_entries filter more useful.
We also complete removed the form/entry fields property. All usage should be replaced with formFields.
New features
- [Breaking] Removed
fieldsfromentryandform. Please update your code to useformFieldsinstead. - [Breaking] Added support for submitting email confirmation values by using a new input type
FieldValuesInput.emailValues.
{
submitGravityFormsForm(
input: {
formId: 1
clientMutationId: "123abcc"
fieldValues: [
{
id: 1
- value: "[email protected]"
+ emailValues: {
+ value: "[email protected]"
+ confirmationValue: "[email protected]" # Only necessary if Email confirmation is enabled.
}
}
]
}
)
}- [Breaking] The
wp_graphql_gf_can_view_entriesfilter now passesentry_idsinstead offield_ids. This lets you do cool things like allowing authenticated users to edit only their own entries:
add_filter(
'wp_graphql_gf_can_view_entries',
function( bool $can_view_entries, array $entry_ids ) {
if ( ! $can_view_entries ) {
$current_user_id = get_current_user_id();
// Grab each queried entry and check if the `created_by` id matches the current user id.
foreach ( $entry_ids as $id ) {
$entry = GFAPI::get_entry( $id );
if ( $current_user_id !== (int) $entry['created_by'] ) {
return false;
}
}
}
return true;
},
10,
2
);- Deprecated
formFields.edges.fieldValuein favor offormFields.nodes.{value|typeValues}. Not just does this dramatically slim down the boilerplate needed for your queries, but it also works withgatsby-source-wordpress.
{
gravityFormsEntry(id: 2977, idType: DATABASE_ID) {
formFields{
- edges {
- fieldValue {
- ... on TextFieldValue {
- value
- }
- ... on CheckboxFieldValue {
- checkboxValues {
- inputId
- value
- }
- }
- ... on AddressFieldValue {
- addressValues {
- street
- lineTwo
- city
- state
- zip
- country
- }
- }
- }
- }
nodes {
... on TextField {
# Other field properties
+ value
}
... on CheckboxField {
# Other field properties
+ checkboxValues {
+ inputId
+ value
+ }
}
... on AddressField {
# Other field properties
+ addressValues {
+ street
+ lineTwo
+ city
+ state
+ zip
+ country
+ }
}
}
}
}
}- Added support for retrieving
PostImagefield values.
Bugfixes
- Fixed field
ids missing fromUpdateDraftEntry{Type}FieldValueerrors. - Prevented PHP notices about missing
entry_idwhen `submitGravityFormsDraftEntry fails. - Prevented
UpdateDraftEntry{Type}FieldValuefrom deleting the previously storedip. - Entry queries now correctly check for
gform_full_accesspermission whengravityforms_edit_entriesdoesn't exist. - Undeprecate
InputKeyPropertyonnameandaddressfields. Although this is not part of the GF api, it is helpful to associate theinputswith their entryvalues.
Under the hood
- Added more unit tests for
TextField,TextAreaField, andAddressField. - Refactored
FieldPropertyclasses to useAbstractProperty.
v0.4.1 - Bugfix
-Bugfix: Uses sanitize_text_field to sanitize email values, so failing values can be validated by Gravity Forms ( Addresses: #87 ).
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.
v0.3.1 - Bugfixes
This is a bugfix release.
Changelog
- Removes
abstractclass definition from FieldProperty classes. (#79) ConsentFieldValue: Thevaluefield was a conflicting typeBoolean. Now it correctly returns aStringwith the consent message. ( #80 )FormNotificationRouting: ThefieldIdnow correctly returns anIntinstead of aString. (#81)- When checking for missing
GravityFormsFormvalues,limitEntriesCount,scheduleEndHourandscheduleEndMinutenow correctly return as typeInt(#83)
v0.3.0 - Add Missing Mutations, the Consent Field, and more!
This release focuses on adding in missing mutations for existing form field - including those needed for Post Creation. We also added support for the Consent field, and squashed some bugs.
New Field Support: Consent
- Added
consentFieldandupdateDraftEntryConsentFieldValue.
New Field Mutations
- Added
updateDraftEntryChainedSelectFieldValuemutation. - Added
updateDraftEntryHiddenFieldValuemutation. - Added
updateDraftEntryPostCategoryFieldValuemutation. - Added
updateDraftEntryPostContentFieldValuemutation. - Added
updateDraftEntryPostCustomFieldValuemutation. - Added
updateDraftEntryPostTagsFieldValuemutation. - Added
updateDraftEntryPostTitleFieldValuemutation.
Added Field Properties
- Added the
isHiddenproperty toPasswordInput.
Bugfixes
- Changed the way we were saving the
listFieldvalues for both single- and multi-column setups, so GF can read them correctly. - Fix a bug where a PHP Notice would be thrown when no
listFieldvalue was submitted - even if the field was not required. - Fixed a bug that was preventing unused draft signature images from getting deleted.
- Updated how we retrieve the signature url so we're no longer using deprecated functions.
Misc.
- Renamed
ListInputandListFieldValueproperties to something more sensical.input.value.valuesis nowinput.value.rowValues, andfieldValue.listValues.valueis nowfieldValue.listValues.values. The old property names will continue to work until further notice. - Updated composer dependencies.
v0.2.0 - Add / Deprecate Field Properties
This release focusds on adding in missing properties on the existing form fields, and deprecating any properties that aren't used by Gravity Forms.
Added field properties:
- Adds following properties to the Address field:
descriptionPlacement,subLabelPlacement,copyValuesOptionDefault,copyValuesOptionField,copyValuesOptionLabel,enableCopyValuesOption. - Adds following subproperties to the Address
inputsproperty:customLabel,defaultValue,placeholder. - Adds following properties to the Captcha field:
descriptionPlacement,description,size,captchaType. - Adds following properties to the ChainedSelect field:
descriptionPlacement,description,noDuplicates,subLabel. - Adds following properties to the Checkbox field:
descriptionPlacement,enablePrice. - Adds following properties to the Date field:
descriptionPlacement,inputs,subLabel,dateType. - Adds following properties to the Email field:
descriptionPlacement,inputs,subLabel,emailConfirmEnabled. - Adds following properties to the File Upload field:
descriptionPlacement. - Adds following properties to the Hidden field:
allowsPrepopulate. - Adds following properties to the HTML field:
displayOnly,disableMargins. - Adds following properties to the Name field:
descriptionPlacement,subLabelPlacement. - Adds following subproperties to the Name field
inputsproperty:customLabel,defaultValue,placeholder,choices,enableChoiceValue. - Adds following properties to the Number field:
descriptionPlacement,calculationFormula,calculationRounding,enableCalculation. - Adds following properties to the Page field:
displayOnly,size. - Adds following properties to the Password field:
subLabelPlacement. - Adds following properties to the Phone field:
descriptionPlacement. - Adds following properties to the Post Category field:
descriptionPlacement,noDuplicates,placeholder. - Adds following properties to the Post Content:
descriptionPlacement,maxLength. - Adds following properties to the Post Custom field:
descriptionPlacement,maxLength. - Adds following properties to the Post Excerpt field:
descriptionPlacement,maxLength. - Adds following properties to the Post Image field:
descriptionPlacement. - Adds following properties to the Post Tags field:
descriptionPlacement,enableSelectAll,maxLength. - Adds following properties to the Post Title field:
descriptionPlacement. - Adds following properties to the Radio field:
descriptionPlacement,enablePrice. - Adds following properties to the Section field:
descriptionPlacement,displayOnly. - Adds following properties to the Select field:
defaultValue,descriptionPlacement,enablePrice. - Adds following properties to the Signature field:
descriptionPlacement. - Adds following properties to the TextArea field:
descriptionPlacement,useRichTextEditor. - Adds following properties to the Text field:
descriptionPlacement. - Adds following properties to the Time field:
descriptionPlacement,inputs,subLabelPlacement. - Adds following properties to the Time field:
descriptionPlacement.
Deprecated Field Properties
These properties will be removed in v1.0.
- Deprecate the following properties from the Address field:
inputName. - Deprecate the following properties from the Captcha field:
adminLabel,adminOnly,allowsPrepopulate,visibility. - Deprecate the following properties from the File Upload field:
allowsPrepopulate,inputName. - Deprecate the following properties from the Hidden field:
adminLabel,adminOnly,isRequired,noDuplicates,visibility. - Deprecate the following properties from the HTML field:
adminLabel,adminOnly,allowsPrepopulate,inputName,visibility. - Deprecate the following properties from the Name field:
inputName. - Deprecate the following properties from the Page field:
adminLabel,adminOnly,allowsPrepopulate,label,visibility. - Deprecate the following properties from the Password field:
allowsPrepopulate,visibility. - Deprecate the following properties from the Section field:
adminLabel,adminOnly,allowsPrepopulate. - Deprecate the
keyproperty on all fieldinputsproperties. - Deprecate the following properties from the Chained Select field
inputsproperty:isHidden,name.
Misc.
- [Bugfix] Fix saving draft submission with wrong
gform_unique_idwhen none is set. - [PHPCS] Various docblock and comment fixes.
v0.1.0
Changelog
v0.1.0 - Initial Public Release
This release takes the last year and a half of work on this plugin, and makes it ready for public consumption and contribution, by adopting SemVer, WordPress Coding Standards, etc.
Please see README.md for a list of all functionality included in the plugin.