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.