GithubHelp home page GithubHelp logo

axewp / wp-graphql-gravity-forms Goto Github PK

View Code? Open in Web Editor NEW
161.0 11.0 27.0 3.74 MB

GraphQL API for interacting with Gravity Forms.

License: GNU General Public License v3.0

PHP 98.31% Shell 1.36% Dockerfile 0.33%
wordpress-plugin wordpress gravityforms graphql wp-plugin wp-graphql-gravity-forms wp-graphql wpgraphql wpgraphql-plugin gravity-forms

wp-graphql-gravity-forms's Introduction

alt text

WPGraphQL for Gravity Forms

A WordPress plugin that adds WPGraphQL support for Gravity Forms.


Packagist License Packagist Version GitHub commits since latest release (by SemVer) GitHub forks GitHub Repo stars
Coverage Status WordPress Coding Standards Code Quality Schema Linter

Overview

The WPGraphQL for Gravity Forms plugin is a powerful extension for WPGraphQL that provides a comprehensive suite of features that allows developers to interact with Gravity Forms via GraphQL.

This plugin enhances the developer experience by offering a GraphQL schema tailored for Gravity Forms. The schema provides improved type safety, prevents over-fetching, and makes it easier to interact with your forms and entries than (and even provides functionality not available in) Gravity Form's traditional PHP and REST APIs.

WPGraphQL for Gravity Forms is an essential tool for those leveraging decoupled and headless WordPress architectures. Whether you're using WordPress as a data source for your headless application, integrating Gravity Forms data into an external service, or building custom, interactive form experiences, this plugin offers improved developer experience and features to make your frontend code more robust. It's designed to be a versatile tool, capable of handling any decoupled project from simple form submissions to complex, form-driven applications scalable at an enterprise level.

System Requirements

Quick Install

  1. Install & activate WPGraphQL.
  2. Install & activate Gravity Forms and any supported addons.
  3. Download the wp-graphql-gravity-forms.zip file from the latest release upload it to your WordPress install, and activate the plugin.

Important

Make sure you are downloading the wp-graphql-gravity-forms.zip file from the releases page, not the Source code (zip) file nor a clone of the repository.

If you wish to use the source code, you will need to run composer install inside the plugin folder to install the required dependencies.

With Composer

composer require harness-software/wp-graphql-gravity-forms

Updating and Versioning

As we work towards a 1.0 Release, we will need to introduce numerous breaking changes. We will do our best to group multiple breaking changes together in a single release, to make it easier on developers to keep their projects up-to-date.

Until we hit v1.0, we're using a modified version of Semantic Versioning

v0.x: "Major" releases. These releases introduce new features, and may contain breaking changes to either the PHP API or the GraphQL schema. v0.x.y: "Minor" releases. These releases introduce new features and enhancements and address bugs. They do not contain breaking changes. v0.x.y.z: "Patch" releases. These releases are reserved for addressing issue with the previous release only.

Development and Support

Development of WPGraphQL for Gravity Forms is provided by AxePress Development. Community contributions are welcome and encouraged.

Basic support is provided for free, both in this repo and in WPGraphQL's official Discord.

Priority support and custom development are available to our Sponsors.

Supported Features

  • Querying forms and entries.
  • Submitting forms.
  • Updating entries and draft entries.
  • Deleting entries and draft entries.
  • Triggering builds with WPGatsby and Jamstack Deployments

Future Feature Enhancements

View all Feature Requests

Documentation

Recipes

Sponsors

SafetyHQ (previously Harness Software)

wp-graphql-gravity-forms's People

Contributors

etylermoss avatar justlevine avatar kellenmace avatar koduvaal avatar mosesintech avatar mtdbyanechko avatar natac13 avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-graphql-gravity-forms's Issues

ensure_required_fields_are_set breaks forms with captchas

I have been waiting for the name and address mutations and jumped out of my seat when I saw they got added today!

But when I updated to the latest master it included new validations for fields from PR #22 which break my forms with captchas included (see SubmitDraftEntry.php).

Should there be a mutation for submitting a positive captcha check? Or should captchas be excluded from this function?

[Bug] missing file platform_check.php (plugins/wp-graphql-gravity-forms/vendor/composer/platform_check.php)

Describe the bug

Fatal error: require(): Failed opening required '/var/www/html/web/app/plugins/wp-graphql-gravity-forms/vendor/composer/platform_check.php' (include_path='.:/usr/local/lib/php') in /var/www/html/web/app/plugins/wp-graphql-gravity-forms/vendor/composer/autoload_real.php on line 25

To Reproduce

When installing the plugin using composer and navigating to the wordpress site, I encountered the above error. I checked for the vendor/composer/platform_check.php file but it is not there.

https://github.com/harness-software/wp-graphql-gravity-forms/blob/ee26f46db31f087fc6d8a4003b6ad80de778bfa5/vendor/composer/autoload_real.php#L25

Technical Info

  • WordPress version: 5.6
  • WPGraphQL version: 1.1.3
  • Gravity Forms version: 2.4.22.5
  • WPGraphQL for Gravity Forms version: 'main'
  • Composer version 1.10.5

Inconsistent types for choices field

With this query:

{
  gravityFormsForms {
    nodes {
      fields {
        nodes {
          __typename

          ... on ChainedSelectField {
            choices {
              text
            }
          }

          ... on CalculationField {
            choices
          }
        }
      }
    }
  }
}

I get this result:

{
  "errors": [
    {
      "message": "Fields \"choices\" conflict because they return conflicting types [ChainedSelectChoiceProperty] and String. Use different aliases on the fields to fetch both if this was intentional.",
      "category": "graphql",
      "locations": [
        {
          "line": 9,
          "column": 13
        },
        {
          "line": 15,
          "column": 13
        }
      ]
    }
  ]
}

There seem to be these two conflicting types for this field across a few other inline fragment types as well, but I just added 2 here for reference.

Error

I'm getting the following error. I could be installing it incorrectly. I installed the entire repo, but thought I should only install the src files? Not sure.
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in /home/c132grap/staging/1/wp-content/plugins/wp-graphql-gravity-forms-master/src/WPGraphQLGravityForms.php on line 180

Field errors not being returned for invalid field when using submitGravityFormsForm mutation

Bug Description

If I submit a form with one or more invalid field values using the submitGravityFormsForm mutation, no errors are returned to the client. A success response is sent back with an entryId set to null.

Plugin versions I'm using:

  • Gravity Forms: 2.5.0.1
  • WPGraphQL: 1.3.7
  • WPGraphQL for Gravity Forms: 0.5.0

Screenshot:
Screen Shot 2021-05-03 at 5 18 06 PM

Expected Behavior

When a form is submitted with one or more invalid field values, a UserError should be thrown that includes data about the invalid field(s).

Steps to Reproduce

Create a form with a single-line text field. Set its Max Length property to 5 characters and save the form.

In the GraphiQL instance embedded in the wp-admin, submit the form using a mutation like the one below. Note that the character count being passed in is invalid.

mutation submitForm {
  submitGravityFormsForm(input: {
    formId: 1,
    fieldValues: [
      {
        id: 1,
        value: "123456789"
      },
    ]
  }) {
    entryId
  }
}

Confirm that no errors are returned, and that an entryId of null is in the response.

[Bug] - `fieldFilters` only searches first value in array.

Is your feature request related to a problem? Please describe.

I am unable to search using the fieldFilter option and key === 0, using contains to match against all field array values

Describe the solution you'd like

Be able to search entire field array values

Screen Shot 2021-07-18 at 20 10 36
Screen Shot 2021-07-18 at 20 11 10
Screen Shot 2021-07-18 at 20 11 25

[Bug] Email confirmation subfields not supported

Describe the bug

When submitting an email field, you are forced to use a flat value. However, when email confirmation is enabled, GF expects an array of both the value (${id}.1) and the confirmation value (${id}.2).

h/t @natac13

Expected behavior

You should be able to submit a single flat value or a complex value that includes confirmation.

Technical Info

  • WPGraphQL for Gravity Forms version: 0.4.1

PHP Fatal error

Hi again, so, I can query the form title and id but I can't query to the fields. As you can see on the prints above... any ideia what could be happening?
Captura de ecrã 2020-03-11, às 12 27 58
Captura de ecrã 2020-03-11, às 12 28 15

Change in Mutation

First thank you for creating this plugin. I wanted to see what's the reason behind the API change. The previous implementation was much simpler and intuitive. It doesn't make sense for a user to send a draft mutation and then send mutations for updating every field and then send a final mutation to submit the form. Unless I am not understanding the new API, this is overly complicated. I know it might make sense to keep the implementation similar to the gravity form's core API but to the end users it doesn't matter much. It might be best to add a stand-alone mutation to submit the form in one request.

This makes sense

const [submit] = useMutation(formMutation);

const handleSubmit = async (values, { setSubmitting, setErrors }) => {
        const allTextValues = convertToEntries(form, values);
        try {
            const data = await submit({
                variables: {
                    input: { allTextValues, clientMutationId, formId },
                },
            });
        } catch (e) {
            console.error(e);
            setErrors({ message: e.message });
        } finally {
            setSubmitting(false);
        }
    };

Question: Support for additional fields

Hi. We are checking out this plugin. We notice that additional fields such as GravityForms' own poll field are not supported. Would you be open to support these from this plugin or would you like to keep that in separate WordPress plugins?

Internal Server Error

Hi, I've installed the plugin but my GraphQL just die. You can see the behavior on the attached file.
I'm using the PHP 7.0 version and I've tested with 7.4 without success.
Captura de ecrã 2020-03-11, às 11 45 53

I've enabled the debugin on Wordpress and this is what I get:
Captura de ecrã 2020-03-11, às 11 50 49

Any ideia of what is going on?
Plus, I'm using the last version of GraphQL and GraphiQL!

If you find a solution please let me know :)

Unable to get Form Field Labels and Values

Hi,

I installed a gravity form plugin. Getting the Form Name, Type Name. But unable to get field attributes. How to get field names ex:- (First name, Last Name, Email, etc...).

I read the documentation for future enhancements. how long time will be taken for this implementation?

Is there possible to post data with the type name? Please let me know If possible how to implement it.

mutation { createGravityFormsEntry(input: {clientMutationId: "21", formId: 2}) { clientMutationId entry { form { node { id title fields { nodes { __typename } } } } } } }

mutation expects fieldId to be of type Int, but sub fields are Floats

I'm trying to create a draft form, update it using mutations and finally submit a form. I'm adding a name field via the WP GravityForms plugin, and the name field contains 5 sub fields. These have ID's 1.1 … 1.5.

The trouble is submitting individual text field mutations (name, surname, etc.) via updateDraftEntryTextFieldValue. These mutations expect a fieldId of type Int, whereas my IDs are of type Float.

This is not only troublesome for name fields, but for every field that has sub fields.

Any idea how I can solve this?

Fields "choices" conflict because they return conflicting types

Heyo,

I'm attempting to use this with Gatsby.

Getting the following errors:

 ERROR

 gatsby-source-wordpress  (undefined) location: line 1, column: 1159. location: line 1, column: 4803
	 Fields "choices" conflict because they return conflicting types [ChainedSelectChoiceProperty] and String. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  (undefined) location: line 1, column: 1651. location: line 1, column: 4803
	 Fields "choices" conflict because they return conflicting types [ChoiceProperty] and String. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  (undefined) location: line 1, column: 3218. location: line 1, column: 4803
	 Fields "choices" conflict because they return conflicting types [ListChoiceProperty] and String. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  (undefined) location: line 1, column: 3530. location: line 1, column: 4803
	 Fields "choices" conflict because they return conflicting types [MultiSelectChoiceProperty] and String. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  (undefined) location: line 1, column: 4803. location: line 1, column: 5409
	 Fields "choices" conflict because they return conflicting types String and [ChoiceProperty]. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  (undefined) location: line 1, column: 4803. location: line 1, column: 7313
	 Fields "choices" conflict because they return conflicting types String and [ChoiceProperty]. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  (undefined) location: line 1, column: 4803. location: line 1, column: 8113
	 Fields "choices" conflict because they return conflicting types String and [ChoiceProperty]. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.

Using the latest version of all the things...
Except gravity forms, i'm using version 2.4.11 (just testing using an older version i have access to)

Any thoughts?

thanks

[Feature Request] - Query for a form by Name and add name to where arg for forms query

Is your feature request related to a problem? Please describe.

I would like to be able to query for a form by the title of the form. Between clients a formId can change for the same form. Therefore I need a more specific way to target a form in a single and all query.

Describe the solution you'd like

With:
gravityFormsForm I would like a title arg and not have to provide an id if I give the title
gravityFormsForms I would like a title field on the where argument to filter the queried list by

Add support for additional form fields.

The priority list are main plugin fields, followed by fields that require an official Gravity Forms addons (marked as AO).
3rd-party extensions are beyond the scope.

Advanced Fields

  • File Upload
  • Username AO
  • Password ( needs mutation support )AO
  • Quiz AO
  • Survey AO

Post Fields

  • Post Image

Pricing Fields

  • Product
  • Option
  • Quantity
  • Shipping
  • Total
  • Credit Card
  • 2Checkout card AO
  • Mollie card AO
  • Square card AO
  • Stripe card AO

[Bug] gatsby-source-wordpress doesn't resolve form `fields` or `fieldValue` - workaround provided

Describe the bug

gatsby-source-wordpress currently can't resolve Gravity Forms fields or fieldValue, due to both the way it automagically renames fields, and a bug with Union types.

In the interim, you can apply the following PRs to your local copy of gatsby-source-wordpress:
gatsbyjs/gatsby#29717
gatsbyjs/gatsby#29751

Update: As of v0.4.0, fields has been renamed to formFields, which bypasses the first of the two Gatsby issues.

(feat): Allow querying for all GravityFormsForm(s).

The above would be useful (in my situation) for building all the forms at once without having to know each form id (challenging to get in Gatsby due to the inherent limitations of StaticQueries). Something similar is also seen in gatsby-source-gravityforms with allGfForm.

Example:

{
  gravityFormsForms {
    formId
    ... // etc.
  }
}

Compatibility with wp-graphql v0.8.0

Hi,

Thank you for your hard work with this plugin. I hope all is well with you guys during these special days.

Seems like v0.8.0 of wp-graphql introduced some breaking changes.
Details:
https://github.com/wp-graphql/wp-graphql/releases/tag/v0.8.0

Specifically the changes to the AbstractConnectionResolver is breaking querying for fields inside a form.

Probably #14 is releated to this. My error was very similar:
Fatal error: Class WPGraphQLGravityForms\Connections\FormFieldConnectionResolver contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods (WPGraphQL\Data\Connection\AbstractConnectionResolver::get_loader_name, WPGraphQL\Data\Connection\AbstractConnectionResolver::get_ids, WPGraphQL\Data\Connection\AbstractConnectionResolver::is_valid_offset, ...) in (path)/wp-graphql-gravity-forms/src/Connections/FormFieldConnectionResolver.php on line 9

Any work being done to update the plugin to work with the new version?

Inconsistent id types

This query

{
  gravityFormsForms {
    nodes {
      fields {
        nodes {
          __typename
          ... on AddressField {
            inputs {
              id
            }
          }
          ... on ChainedSelectField {
            inputs {
              id
            }
          }
          ... on CheckboxField {
            inputs {
              id
            }
          }
          ... on NameField {
            inputs {
              id
            }
          }
          ... on PasswordField {
            inputs {
              id
            }
          }
        }
      }
    }
  }
}

produces this result:

{
  "errors": [
    {
      "message": "Fields \"inputs\" conflict because subfields \"id\" conflict because they return conflicting types Float and Int. Use different aliases on the fields to fetch both if this was intentional.",
      "category": "graphql",
      "locations": [
        {
          "line": 8,
          "column": 13
        },
        {
          "line": 9,
          "column": 15
        },
        {
          "line": 28,
          "column": 13
        },
        {
          "line": 29,
          "column": 15
        }
      ]
    },
    {
      "message": "Fields \"inputs\" conflict because subfields \"id\" conflict because they return conflicting types Float and Int. Use different aliases on the fields to fetch both if this was intentional.",
      "category": "graphql",
      "locations": [
        {
          "line": 13,
          "column": 13
        },
        {
          "line": 14,
          "column": 15
        },
        {
          "line": 28,
          "column": 13
        },
        {
          "line": 29,
          "column": 15
        }
      ]
    },
    {
      "message": "Fields \"inputs\" conflict because subfields \"id\" conflict because they return conflicting types Float and Int. Use different aliases on the fields to fetch both if this was intentional.",
      "category": "graphql",
      "locations": [
        {
          "line": 18,
          "column": 13
        },
        {
          "line": 19,
          "column": 15
        },
        {
          "line": 28,
          "column": 13
        },
        {
          "line": 29,
          "column": 15
        }
      ]
    },
    {
      "message": "Fields \"inputs\" conflict because subfields \"id\" conflict because they return conflicting types Float and Int. Use different aliases on the fields to fetch both if this was intentional.",
      "category": "graphql",
      "locations": [
        {
          "line": 23,
          "column": 13
        },
        {
          "line": 24,
          "column": 15
        },
        {
          "line": 28,
          "column": 13
        },
        {
          "line": 29,
          "column": 15
        }
      ]
    }
  ]
}

Looks like id is a float in some places and an int in others. I think these should all be Int

[Bug] Email inputs returning empty on validation

Describe the bug

Specifically, the email input is only validated by the backend if it is a required input. the message returned says "This is required" vs something like "format is incorrect".

To Reproduce

  1. Using the submitGravityFormsForm mutation, make an unrequired email input
  2. Submit email incorrectly e.g. "email@example."
  3. Submit mutation.

Expected behavior

If the email format is incorrect then throw an error.

Additional context

Add any other context about the problem here.

Technical Info

  • WordPress version: 5.7
  • WPGraphQL version: 1.3.5
  • Gravity Forms version: 2.4.23
  • WPGraphQL for Gravity Forms version: 0.4.0
  • Other relevant frameworks/plugins: NextJS

500 error after activating plugin

After activating plugin /graphql endpoint doesn't work. It responces 500 error.
Dependencies:

  • WP GraphQL 0.3.6
  • Gravity Forms 2.3.0.4

When I deactivating it, everything works fine. And I can query graphql.

Sorry, you are not allowed to view Gravity Forms entries

Activated gravityforms and this plugin, and have a few forms (with entries), but when doing this inside the GraphiQL env (within WP)
query myQuery {
gravityFormsEntries {
nodes {
id
}
}
}

I get "Sorry, you are not allowed to view Gravity Forms entries".

What am I missing or doing wrong ? Do I have to enable something in settings (can't seem to find anything either..)

Form Notification

First, thank you for a great plugin.

I have successfully created the a working form for my headless website. The only issue I have is that Gravity Forms is not sending the email notification after a form has been submitted. I tested sending the notification manually from the GF entry list and it works.

Does your plugin support form email notification?

Form fields returning Null

I have a form querying which is returning the correct information for title, description etc so can confirm the ID's match and the form is present but fields are showing null in the response, even though the correct fragments are being used for the fields:

{
  gravityFormsForm(id: "R3Jhdml0eUZvcm1zRm9ybToy") {
    formId
    cssClass
    title
    description
    fields(first: 3) {
      nodes {
        ... on TextField {
          id
        }
        ... on TextAreaField {
          id
        }
      }
    }
  }
}
"data": {
    "gravityFormsForm": {
      "formId": 2,
      "cssClass": "sideform",
      "title": "Sidebar Enquiry",
      "description": "Small enquiry form to be shown on global sidebars throughout the site.",
      "fields": {
        "nodes": [
          null,
          null,
          null
        ]
      }
    }
  }

I have two single text fields and a paragraph text field on this form — am I missing something in getting them to query? Have also tried removing the arguments from fields as well as trying with the inclusion of after: fields(first: 3, after: null) — both give the same results.

Add missing Codeception tests.

The majority of the plugin is missing unit tests, but we should start with prioritizing field and field values. Here's an non-exhaustive list:

  • AddressField
  • CaptchaField
  • ChainedSelectField
  • CheckboxField
  • ConsentField
  • DateField
  • EmailField
  • FileUploadField
  • HiddenField
  • HtmlField
  • ListField
  • MultiSelectField
  • NameField
  • NumberField
  • PageField
  • PasswordField
  • PhoneField
  • PostCategoryField
  • PostContentField
  • PostCustomField
  • PostExcerptField
  • PostImageField
  • PostTagsField
  • PostTitleField
  • RadioField
  • SectionField
  • SelectField
  • SignatureField
  • TextAreaField
  • TextField
  • TimeField
  • WebsiteField

We can probably refactor the existing tests to make writing new ones faster and easier.

Unable to fetch aan individual Gravity Form by its ID

Hi,

Unable to fetch an individual Gravity Form by its ID. How to get A valid global ID. Please let me know.

Thankyou

Query

{ gravityFormsForm(id:"1"){ title } }

Result

{ "errors": [ { "message": "A valid global ID must be provided.", "category": "user", "locations": [ { "line": 2, "column": 3 } ], "path": [ "gravityFormsForm" ] } ], "data": { "gravityFormsForm": null } }``

Compatibility with WPGraphQL V1.0 - FormFieldConnectionResolver missing methods

Hello,

Just wanting to confirm if anyone here has confirmed this plugin to be working with WPGraphQL V1.0+?

On V1.0, fatal PHP errors are caught when trying to query and fields on a form.

Class WPGraphQLGravityForms\\Connections\\FormFieldConnectionResolver contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (WPGraphQL\\Data\\Connection\\AbstractConnectionResolver::get_loader_name, WPGraphQL\\Data\\Connection\\AbstractConnectionResolver::get_ids, WPGraphQL\\Data\\Connection\\AbstractConnectionResolver::is_valid_offset) in /var/www/vhosts/mysite.com.au/httpdocs/web/app/plugins/wp-graphql-gravity-forms/src/Connections/FormFieldConnectionResolver.php on line 8, referer: https://mysite.com.au/wp/wp-admin/admin.php?page=graphiql-ide

Plugin Activation breaks site. Parse error: syntax error, unexpected '=>'

HI everyone!
Every time i activate plugin it breaks site. with debbug on gives this: 'Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in /www/wp-content/plugins/wp-graphql-gravity-forms-master/src/WPGraphQLGravityForms.php on line 180'
Can anyone assist with this.
Thanks!

P.s. WP version 5.4.2 | PHP version 7.3

'Too few arguments to function ...' when querying entry fieldValue.

I am querying for a specific form entry (though this behavior occurs when using gravityFormsEntries), and if I query for the EmailField fieldValue, null is simply returned and an internal server error occurs, with the debug message: Too few arguments to function WPGraphQLGravityForms\\Types\\Union\\ObjectFieldValueUnion::WPGraphQLGravityForms\\Types\\Union\\{closure}(), 1 passed and exactly 3 expected. The form only contains the EmailField, double checked that the entry exists. Cheers.

Query:

{
  gravityFormsEntry(id: "R3Jhdml0eUZvcm1zRW50cnk6Mw==") {
    formId
    ip
    fields {
      edges {
        node {
          ... on EmailField {
            id
            type
            label
          }
        }
        fieldValue {
          ... on EmailFieldValue {
            value
          }
        }
      }
    }
  }
}

Query result:

{
  "errors": [
    {
      "debugMessage": "Too few arguments to function WPGraphQLGravityForms\\Types\\Union\\ObjectFieldValueUnion::WPGraphQLGravityForms\\Types\\Union\\{closure}(), 1 passed and exactly 3 expected",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 12,
          "column": 9
        }
      ],
      "path": [
        "gravityFormsEntry",
        "fields",
        "edges",
        0,
        "fieldValue"
      ]
    }
  ],
  "data": {
    "gravityFormsEntry": {
      "fields": {
        "edges": [
          {
            "node": {
              "id": 2,
              "type": "email",
              "label": "Email"
            },
            "fieldValue": null
          }
        ]
      },
      "ip": "10.48.210.1",
      "formId": 2
    }
  }
}

Add ability to query for lists of draft entries

Gravity Forms doesn't have a public API for accessing a list existing draft entries, instead requiring you to know the draft token.

A database query needs to be written to grab all of them, so we can support both gravityFormsDraftEntries and including draft entries in the existing gravityFormsEntries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.