Releases: AxeWP/wp-graphql-gravity-forms
v0.7.2.1 - Hotfix
(Re-released, as the last one incorectly contained the old version.)
- Fixes bug where unset
formFields
properties would cause a type error forEnums
. (h/t @natac13)
v0.7.1 - Bugfix
This release fixes the following bugs:
- fix: Prevents
UserError
when filteringgravityFormsEntries
by a value in any field (i.e. whenfieldFilters.key
is"0"
).
v0.7.0 - File Uploads and Post Image Submissions 🚀🚀🚀
**
The big highlight in this release is experimental*** support for File Upload / Post Image submissions. We also added a feature that updates WordPress post meta when the corresponding Gravity Forms entry is updated.
We added some new WordPress filters, and changed the way some of our PHP classes work, to make it easier for people to add support for their own custom Gravity Forms fields.
We even gave the docs some love. We've added info about filters and using specific form field value inputs, and updated many of the example snippets. You can find the new documnetation in the repo's /docs folder.
Note: These changes did necessitate refactoring many of the plugin classes, so if you're extending any of them in your own projects, make sure to update your class methods!
***: File Uploads and Post Image submissions currently require WPGraphQL Upload to be installed and activated. Once WPGraphQL adds native support for multipart form requests, it is likely that these GraphQL input values will change.
New Features
- Added support for
FileUpload
andPostImage
field value submissions. Ple - Updating Post field values in a Gravity Forms entry, now also updates the corresponding WordPress post. Not even native GF lets you do that!
- New WordPress filters:
wp_graphql_gf_type_config
,wp_graphql_gf_connection_config
.
Bugfixes
chainedSelectValues
input is now only visible if the Chained Selects plugin is active.- The
Entry
GraphQL type now implements thewp_graphql_gf_can_view_entries
filter.
Under the Hood
- feat: add
altText
toPostImage
field values. - feat: The
pageNumber
field is now available on allformFields
. - dev:
AbstractEnum::set_values()
has been deprecated in favor ofAbstractEnum::get_values()
. - dev:
Button
,LastPageButton
,ConditionalLogic
,ConditionalLogicRule
,Entry
,EntryForm
,EntryUser
,FieldError
,Form
,FormComfirmation
,FormNotification
,FormNotificationRouting
,FormPagination
,SaveAndContinue
, now extend AbstractObject`. Their functions have changed accordingly. - dev: Added
GFUtils::get_gravity_forms_upload_dir()
andGUtils::handle_file_upload()
. - dev: Added
Utils::maybe_decode_json()
andUtils::apply_filters
. - dev: deprecated
wp_graphql_{$enumType}_values
filter, in favor ofwp_graphql_gf_{$enumType}_values
. - dev: deprecated
wp_graphql_gf_field_types
filter, as it no longer necessary to manually map GraphQL fields to GFformFields
. - dev: deprecated
wp_graphql_gf_form_field_instances
andwp_graphql_gf_field_value_instances
filters in favor ofwp_graphql_gf_instances
. - dev: Deprecated the
adminOnly
,allowsPrepopulated
andinputName
fields onPostImageField
. - dev: Updated composer dependencies.
- dev!:
scr/connections
now extendAbstractConnection
- dev!:
src\Types\Input
now extendAbstractInput
. Their functions have changed accordingly. - dev!: Class
AbstractField
has been deprecated in favor ofAbstractFormField
. Its functions have changed accordingly. - dev!: Classes
AbstractProperty
,AbstractFieldValue
have been deprecated in favor ofAbstractObject
. Their functions have changed accordingly. - dev!: make plugin
$instances
static for easier access and extension. - dev!: The
Enum
,InputType
,ValueProperty
PHP interface has been deprecated. Please update your code. - dev!: The methods required by the
FieldValue
,Type
PHP interface have changed. Please update your code. - tests: Removed
testGetEnabledFieldTypes
now that we are usingstatic $instances
.
v0.6.3 - Unit Tests
- Adds support for missing date formats (
dmy_dash
,dmy_dot
,ymd_slash
,ymd_dash
, andymd_dot
). - Fix:
EmailInputProperty
description updated. - Dev:
autocompleteAttribute
has been deprecated onEmailInputProperty
. - Tests: Added
updateEntry
andupdateDraftEntry
mutations to existingformField
tests. - Tests: Add tests for CheckboxField, ConsentField, and DateField.
v0.6.2.2 - Hotfix
- Fixes
submitGravityFormsForm
mutation not saving signature field value after v0.6.2.1.
v0.6.2.1 - Hotfix
- Fixes
updateGravityFormsEntry
not saving signature field value.
v0.6.2 - Bugfixes
v0.6.2 - Bugfixes
- Fixes
updateGravityFormsEntry
mutation not propery saving complex field values (h/t @natac13 ) - Fixes mutations not correctly deleting old
SignatureField
files from the server (h/t @natac13 ) - Fixes
SignatureFieldValue
s failing Gravity FormsisRequired
validation (h/t/ @natac13). - Fixes empty
formFields.layoutGridColumnSpan
values not returning asnull
. - Removes deprecation from
ChainedSelectInput.name
. - Correctly sets
graphql_connection_max_query_amount
to a minimum of600
. AbstractMutation::prepare_field_value_by_type()
no longer tries processing unrecognized fields.- Dev: Added filter
wp_graphql_gf_prepare_field_value
for processing custom field values. - Dev: Added filter
wp_graphql_gf_field_value_type
for adding custom field value input types. - Dev: The arguments for
AbstractMutation::validate_field_value()
have changed to no longer require passing the$form
. Passing the old set of arguments may stop working in future versions of the plugin. - Tests: Added unit tests for
ChainedSelect
fields and values.
v0.6.1 - Bugfix
- Fixes a fatal error when adding support for new fields with the
wp_graphql_gf_field_types
filter.
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
,validationSummary
andversion
toGravityFormsForm
object. - Added
layoutGridColumnSpan
andlayoutSpacerGridColumnSpan
toformFields
interface. - Added
enableAutocomplete
andautocompleteAttribute
toAddressField
,EmailField
,NameField
,NumberField
,PhoneField
,SelectField
, andTextField
. - Added
displayOnly
property toCaptchaField
. - Added
allowedExtensions
anddisplayAlt
property toPostImageField
. - Added
sort
argument for filteringRootQueryToGravityFormsFormConnection
. Note: Attempting to sort on GF < v2.5.0.0 will throw aUserError
.
Bugfixes
- [Breaking]: Fixed the
captchaTheme
enum to use the correct possible values:light
anddark
. captchaTheme
andcaptchaType
now correctly returnnull
when not set by the field.- The
captchaType
enum now has a default value ofRECAPTCHA
.
Under the hood
- Refactor various
InputProperty
classes.InputDefaultValueProperty
,InputLabelProperty
, andInputplaceholderProperty
have been removed for theirFieldProperty
cousins, andEmailInputProperty
is now being used forEmailField
. - Tests: Clear
GFFormDisplay::$submission
between 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
fields
fromentry
andform
. Please update your code to useformFields
instead. - [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: "myemail@email.test"
+ emailValues: {
+ value: "myemail@email.test"
+ confirmationValue: "myemail@email.test" # Only necessary if Email confirmation is enabled.
}
}
]
}
)
}
- [Breaking] The
wp_graphql_gf_can_view_entries
filter now passesentry_ids
instead 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.fieldValue
in 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
PostImage
field values.
Bugfixes
- Fixed field
id
s missing fromUpdateDraftEntry{Type}FieldValue
errors
. - Prevented PHP notices about missing
entry_id
when `submitGravityFormsDraftEntry fails. - Prevented
UpdateDraftEntry{Type}FieldValue
from deleting the previously storedip
. - Entry queries now correctly check for
gform_full_access
permission whengravityforms_edit_entries
doesn't exist. - Undeprecate
InputKeyProperty
onname
andaddress
fields. Although this is not part of the GF api, it is helpful to associate theinputs
with their entryvalues
.
Under the hood
- Added more unit tests for
TextField
,TextAreaField
, andAddressField
. - Refactored
FieldProperty
classes to useAbstractProperty
.