Giter VIP home page Giter VIP logo

acf-gravityforms-add-on's Introduction

Advanced Custom Fields Gravity Forms Add-on

Provides an Advanced Custom Field which allows a WordPress editorial user or administrator to select a Gravity Form as part of a field group configuration.

Getting started

The plugin is primarily available from the WordPress plugin repository. It allows you to choose a Gravity Form in WordPress Admin and use the selected form ID in your Theme or Plugin to output the form.

This plugin does not have any effect on the output of the website. It adds a custom ACF field type for use in an ACF field group.

Installation and usage

  1. Upload the plugin files to the /wp-content/plugins/acf-gravityforms-add-on directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress.
  3. Add a new field of type 'Forms' to the required ACF field group.

You can also install Advanced Custom Fields: Gravity Forms Add-on using Composer.

composer require dannyvanholten/acf-gravityforms-add-on

…or if you make use of WPackagist, …

composer require wpackagist-plugin/acf-gravityforms-add-on

Using Advanced Custom Fields: Gravity Forms Add-on

To use the the field you just need to know how Advanced Custom Fields work. You can check out their documentation.

The Gravity Forms Add-on returns either an single form object / ID or an array of objects / IDs. Now we know that we can easily use it to build our fields :)

Output of the form in the frontend

This plugin doesn't integrate any code to the frontend of the website. You will need to ensure that your own Plugin or Theme handles the output of the form. An example of how do do this is detailed in this blog post on the Gravity Forms website.

Getting the form ID

Please refer to the documentation for the ACF method get_field for full details of how to use it.

If you return an ID from your ACF field configuration:

$form_id = get_field('my-form');
gravity_form($form_id);

If you return an object/array from your ACF field configuration:

$form = get_field('my-form');
gravity_form($form['id']);

If you return multiple Form IDs from your ACF field configuration:

$form_ids = get_field('my-form');

foreach($form_ids as $form_id) {
    gravity_form($form_id);
}

Filtering the field HTML

Version 1.3.4 added a plain HTML filter to the output of the field. This filter is not applied to fields in ACF version 4.

apply_filters('acf-gravityforms-add-on/field_html', string $field_html, array $field, string $field_options, string $multiple)

Getting involved

Want to get involved and improve Advanced Custom Fields: Gravity Forms Add-on? Fork this repo and whenever you have something just make a pull request. After review we might add it to our GitHub Repository.

Credits

This plugin is maintained by Say Hello GmbH, a specialist WordPress agency in Spiez, Switzerland.

The plugin was initially developed by Danny van Holten based on work by @stormuk, (@lgladdy and @adampope).

acf-gravityforms-add-on's People

Contributors

bonny avatar cezarpopa avatar dannyvanholten avatar markhowellsmead avatar normanfrancis avatar spivurno 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

Watchers

 avatar  avatar  avatar  avatar

acf-gravityforms-add-on's Issues

Add disabled field option

I have a need to add a disabled option once a form is chosen and saved. I have done this in the Field.php file myself. Wondering if a feature request like this is applicable?

This is more of a "developer" feature as there would be no need to disable the field otherwise.

Thanks for the quick plugin, it works great!

Removing form associated with custom post type

Great plugin, thanks for this!

I've used it to associate instances of Gravity Forms with instances of a custom post type, which works well.

However, if I want to remove a previously selected form from a custom post it seems to work (if I return to edit the custom post the form is no longer selected) but when I query my custom posts in PHP and do a get_field(my_form_key) on them the original form ID still seems to be returned.

Have I omitted to do something necessary?

Multiple choices select does not populate multiple choices ACF field values

We create a multiple choices field in Gravity:

1: Fuu
2: Faa
3: Foo

We create a multiple choices field in ACF for same content type:

1: Fuu
2: Faa
3: Foo

When selected any of the values in Gravity Form let's say 1, 3, only first one is stored in ACF field (1.) In case of 2, 3, then only 2 value is stored in ACF field.

Is this related or even the same as #22 ? Why is this issue not in the scope of acf-gravitforms-add-on plugin? (we are paid customers)

Conflict with GF Coupon add on Plugin

Hi Danny,

Your plugin is awesome, but I've run into a conflict with it.

I'm using the Gravity Forms Coupon Add-On (https://www.gravityforms.com/add-ons/coupons/) and when I install the ACF/GF Add-On the coupon input field no longer appears in my forms. When I disable AFC/GF it appears again.

Edit: I also confirmed this bug is causing the 'Username' field to disappear.

I understand that you may not guarantee performance with optional add-ons, but I thought I'd let you know about the conflict, as it took me awhile to suss it out.

Thanks,
Adam

Conflict with Gravity Forms Range Slider

Plugin Website: https://www.gfrangeslider.com/

Issue
When the GF/ACF plugin is activated, the range slider fields do not render. When deactivated, they work again. I went through the GF/ACF and tried to debug it a bit myself: the GF/ACF plugin does not cause a conflict in any place that i can see except for the notifications class (Notices.php). I'm not exactly sure what part of it is causing the conflict, but it's a pretty small file? For right now, I just commented out the $this->addNotices(); from the class constructor, but this is obviously not a great long-term solution, so I was hoping that something could be done and integrated into the plugin for posterity.

Please let me know if you need any more information; happy to provide whatever you need and/or help in any way. Thanks!

Rename Forms into Gravity Forms

It is better if you name it Gravity Forms in field types instead of just forms.
The reason why is that it conflicts with ACF Extended. See the screenshot below.
image

You can also implement a way to detect ACF Extended and it will rename itself to Gravity Forms. This will help us to avoid confusion.

Sorting of form list in dropdown

It would be nice if the list of forms in the dropdown were sorted by title rather than ID.

/resources/Field.php
line 97

Replace
$this->forms = GFAPI::get_forms();

With
$this->forms = GFAPI::get_forms(true,false,'title');

Performance issue: Every ACF GravityForms field render, it gets all forms

Hi there, thanks for creating this plugin!
We use it for a lot of our projects.

For one of our projects however we are running into a performance issue.
This is because every time an ACF GravityForms field is rendered, it's actually getting all forms from the database.
And this specific website has approximately 300+ forms.

When we have a few occurencies of this ACF GF field on the edit page, it becomes really slow.
In this website, it's doing a lot of GFForms::get_form() queries because of this, resulting in 2901 database queries to get a form. In total, this could cause an extra page load time of up to 10 seconds.
Also see screenshot below of the Query Monitor tool.
There you can see that 7 times a single form is loaded from the database, it is caused by the field render of the ACF gravityforms plugin (which corresponds to the 7 ACF gravityforms fields on the edit-page screen).

image

We can easily change the behavior of the render_field function in this plugin, to only load all the forms once.

I will attempt to create a PR for you today with this fix.
Hoping you'll be able to take a look if you agree with the fix.
Thanks in advance!

Document call to gravity_form_enqueue_scripts

Following a discussion with support to resolve an issue with gravityforms, I added the call gravity_form_enqueue_scripts more or less as by their instructions on https://www.gravityforms.com/embed-forms-using-code/ .

This could be further improved, but is sufficient for my case. It should at least be mentioned in the docs IMHO and could possibly be integrated in this plugin:

// Required for gravity forms
//
function gf_enqueue_required_files() {
    GFCommon::log_debug( __METHOD__ . '(): running.' );
    $form_object = get_field('form');
    if(!empty($form_object) && isset($form_object['id'])) {
        // print '<!-- calling gravity_form_enqueue_scripts '.$form_object['id'].'-->'.PHP_EOL;
        gravity_form_enqueue_scripts($form_object['id'], true);
    }
}
add_action( 'get_header', 'gf_enqueue_required_files' );
```

Custom Field checkboxes not populating when multiple selected from form

I have a front-end Gravity form that I want to populate into custom fields for a custom post type, in this instance, called Portfolio...but it's only passing one value, not all selected for the checkbox fields from the form. I'm furthermore then using that entered data to display via shortcode (or merge tags if needed, but prefer acf shortcode) into the design of that Portfolio item in the front-end. I've been troubleshooting wondering if there's some conflict between plugins as I'm also using Gravity Forms + Custom Post Types plugin, but so far I am not sure yet. Any idea why this might be happening and/or how to fix it?

Conflict with Gravity Forms custom fields

I'm registering custom fields to Gravity Forms by extending the GF_Field class. See https://docs.gravityforms.com/gf_field/

For some reason whenever I have the ACF Gravityforms Addon activated the input of custom field I created using the method get_field_input won't render. It looks like it doesn't get triggered.

To confirm this, I installed a new Wordpress site (using default theme), installed Gravity Forms, and the code for the custom field. Everything worked fine until I installed this addon. Deactivating the addon will fix the issue.

Conflict with Gravity Forms Signature Add-On

Hi Danny,

My report is extremely similar to issue #23, and I really liked his text, so I'm going to reuse it if that's all right.

Your plugin is awesome, but I've run into a conflict with it.

I'm using the Gravity Forms Signature Add-On (https://www.gravityforms.com/add-ons/signature/) and when I install the ACF/GF Add-On the signature input field no longer appears in my forms. When I disable AFC/GF it appears again. More specifically, the label for the field appears, but the actual signature box does not.

I understand that you may not guarantee performance with optional add-ons, but I thought I'd let you know about the conflict, as it took me awhile to suss it out.

Thanks,
Josh

WPGraphQL integration

In my projects, I'm using WPGraphQL to query data from WP as a headless CMS. With this, I use ACF and Gravity Forms. There are integration plugins that make it possible to query ACF fields and GF forms through WPGraphQL. This plugin handily provides the bridge between ACF and GF, but sadly, the field added by this plugin does not show up in the WPGraphQL schema. It would be very nice if this plugin could add support for this, or if a separate plugin would be created that would bridge the gap.

There is an open issue on the WPGraphQL for ACF repo (wp-graphql/wp-graphql-acf#249) that considers a similar issue. It seems like the effort to allow ACF extensions to work with WPGraphQL for ACF has stopped a while ago, but I still hope it would be possible to add support, potentially with some help from the WPGraphQL team.

Doesn't save values when added to ACF options pages

I've added a form field to an options page, and it looks like nothing gets saved to the site options. When using AFC on options pages, the standard behavior is to create a site option with a 'options_' prefix before the field key, e.g. if your field key was 'gravity_form', it creates a site option with the key 'options_gravity_form'. Using this plugin, no options get saved to the database.

Thanks for making and maintaining this plugin, BTW. It's very handy, and works well.

Fatal Error on latest update

The latest update added require __DIR__ . '/platform_check.php'; to autoload_real.php on line 25, but there isn't a platform_check.php file to load. Commenting out that line fixed problems as near as I can tell.

Only echo form ID?

Hi there,
I'm trying to count the number of entries in a particular selected form. The code I use manually is:

$summary = RGFormsModel::get_form_counts(4);

But if I want to instead echo the count of the form selected, for instance, I've tried:

$sales_form = get_field('associated_order_form');
$summary = RGFormsModel::get_form_counts($sales_form['id']);

and it doesn't work. What am I doing wrong here?

Removing forms from custom posts

Great plugin, thanks for this!

I've used it to associate instances of Gravity Forms with instances of a custom post type, which works well.

However, if I want to remove a previously selected form from a custom post it seems to work (if I return to edit the custom post the form is no longer selected) but when I query my custom posts in PHP and do a get_field(my_form_key) on them the original form ID still seems to be returned.

Have I omitted to do something necessary?

Conflict with GF Survey add-on

Hi,

First; Very handy plugin, thanks! :)
I do have a small bug, when activating your acf-gravityforms-add-on, the survey add-on from Gravity Forms breaks on the front-end. What happens is that the label is showed, but the html for the field is not showing up. I don't get any console errors ...

Thanks if you have a chance to take a look at it.

Make forms appear in repeater

I'm trying to make forms appear in a repeater. When I use the code:

$form_id = get_field('my-form');
gravity_form($form_id);

I just get the error "Oops! We could not locate your form."

I have replace 'my-form' with the right custom field. Is this a known issue?

Ability to choose default form?

Is there an ability to specify a default form? On the site I'd like to use this on, I'd rather it not be the first form in the list in case my client accidentally forgets to change it. Otherwise, thank you for this plugin!

Co-owner

Hey guys. Since I am not working with WordPress anymore and I've switched to React for building websites at another company. I wanted to keep my plug-ins up-to-date but I am struggling to do so. Because of not having PHP, WordPress & several plugin licences but also because of motivation.

I'm therefore looking for (an)other person(s) who wants to improve, maintain & co-own the plugin. Please let me know if you're interested in this. I would like to keep the code quality high, so I will still review code together with you :)

Hope to find someone so we can get this plugin up-to-date again!

Issue with forced AJAX

Okay, this is an issue I've encountered a few times on one particular site.

Whenever a form is submitted, it continously tries to submit via AJAX (this being the issue) despite saying to redirect to a thank you page in the form confirmation settings.

I've tested this by using the shortcode on a regular page, and that works fine.

I believe it is this plugin in particular, as the shortcode works fine in other ACF field groups.

Plugin Work With Latest Wordpress Version?

Enabled the plugin after downloading it but when I select the forms field in ACF nothing is populating or showing up? Based on the old Wordpress Screenshots on the repository there should be a selection field correct? This doesn't appear for me anymore and don't see any errors in my console./
noform

Fatal error after update

Hey, my client's site crashed because of this:
PHP Fatal error: require(): Failed opening required '/var/www/html/wp-content/plugins/acf-gravityforms-add-on/vendor/composer/platform_check.php' (include_path='.:/usr/local/lib/php') in /var/www/html/wp-content/plugins/acf-gravityforms-add-on/vendor/composer/autoload_real.php on line 25
all plugins are on latest version

Adding gravityforms to graphql

Hi! Love the plugin, but would it be possible to make the plugin queryable via graphql? This would come in handy as more sites move to a headless approach. Cheers!

Feature request: exclude some Gravity Forms by ID

Thanks for the great plugin!

I recently had a use case for excluding a certain form by its ID. Would it be possible to add a hook that would allow to filter the Gravity Forms that get into the field values?

Activation hook

I actually want the actual plugin to activate in my hook if the plugin is there but inactive. Otherwise it should go the download page of that plugin

save selected Form in the Backend

Hi - I have a problem with the Plugin.
Is use the latest Wordpress Version (4.7.3) and the latest ACFpro Plugin.
My Problem:
i choose a form, and save the Page. De Edit-Page Reloads every Field is saved, but not the Field for the Forms. Is this a Bug?

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.