gform_add_field_buttons

gform_add_field_buttons

DescriptionUsageParametersExamplesExample OneExample TwoExample ThreePlacementSource Code

Description
This filter can be used to add/edit/remove the 「add field」 buttons from the form editor』s floating toolbox
Usage
1add_filter( 'gform_add_field_buttons', 'add_map_field' );

Parameters

$field_groups array
The array to be filtered. It contains the field groups (i.e. Standard Fields, Advanced Fields, etc…). Each group then has a 「fields」 array containing all the fields in the group. Below is how this array is defined:

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253$standard_fields = array(    array( 'class' => 'button', 'data-type' => 'text', 'value' => GFCommon::get_field_type_title( 'text' ) ),    array( 'class' => 'button', 'data-type' => 'textarea', 'value' => GFCommon::get_field_type_title( 'textarea' ) ),    array( 'class' => 'button', 'data-type' => 'select', 'value' => GFCommon::get_field_type_title( 'select' ) ),    array( 'class' => 'button', 'data-type' => 'multiselect', 'value' => GFCommon::get_field_type_title( 'multiselect' ) ),    array( 'class' => 'button', 'data-type' => 'number', 'value' => GFCommon::get_field_type_title( 'number' ) ),    array( 'class' => 'button', 'data-type' => 'checkbox', 'value' => GFCommon::get_field_type_title( 'checkbox' ) ),    array( 'class' => 'button', 'data-type' => 'radio', 'value' => GFCommon::get_field_type_title( 'radio' ) ),    array( 'class' => 'button', 'data-type' => 'hidden', 'value' => GFCommon::get_field_type_title( 'hidden' ) ),    array( 'class' => 'button', 'data-type' => 'html', 'value' => GFCommon::get_field_type_title( 'html' ) ),    array( 'class' => 'button', 'data-type' => 'section', 'value' => GFCommon::get_field_type_title( 'section' ) ),    array( 'class' => 'button', 'data-type' => 'page', 'value' => GFCommon::get_field_type_title( 'page' ) ),); $advanced_fields = array(    array( 'class' => 'button', 'data-type' => 'name', 'value' => GFCommon::get_field_type_title( 'name' ) ),    array( 'class' => 'button', 'data-type' => 'date', 'value' => GFCommon::get_field_type_title( 'date' ) ),    array( 'class' => 'button', 'data-type' => 'time', 'value' => GFCommon::get_field_type_title( 'time' ) ),    array( 'class' => 'button', 'data-type' => 'phone', 'value' => GFCommon::get_field_type_title( 'phone' ) ),    array( 'class' => 'button', 'data-type' => 'address', 'value' => GFCommon::get_field_type_title( 'address' ) ),    array( 'class' => 'button', 'data-type' => 'website', 'value' => GFCommon::get_field_type_title( 'website' ) ),    array( 'class' => 'button', 'data-type' => 'email', 'value' => GFCommon::get_field_type_title( 'email' ) ),    array( 'class' => 'button', 'data-type' => 'password', 'value' => GFCommon::get_field_type_title( 'password' ) ),    array( 'class' => 'button', 'data-type' => 'fileupload', 'value' => GFCommon::get_field_type_title( 'fileupload' ) ),    array( 'class' => 'button', 'data-type' => 'captcha', 'value' => GFCommon::get_field_type_title( 'captcha' ) ),    array( 'class' => 'button', 'data-type' => 'list', 'value' => GFCommon::get_field_type_title( 'list' ) )); $post_fields = array(    array( 'class' => 'button', 'data-type' => 'post_title', 'value' => GFCommon::get_field_type_title( 'post_title' ) ),    array( 'class' => 'button', 'data-type' => 'post_content', 'value' => GFCommon::get_field_type_title( 'post_content' ) ),    array( 'class' => 'button', 'data-type' => 'post_excerpt', 'value' => GFCommon::get_field_type_title( 'post_excerpt' ) ),    array( 'class' => 'button', 'data-type' => 'post_tags', 'value' => GFCommon::get_field_type_title( 'post_tags' ) ),    array( 'class' => 'button', 'data-type' => 'post_category', 'value' => GFCommon::get_field_type_title( 'post_category' ) ),    array( 'class' => 'button', 'data-type' => 'post_image', 'value' => GFCommon::get_field_type_title( 'post_image' ) ),    array( 'class' => 'button', 'data-type' => 'post_custom_field', 'value' => GFCommon::get_field_type_title( 'post_custom_field' ) ),); $pricing_fields = array(    array( 'class' => 'button', 'data-type' => 'product', 'value' => GFCommon::get_field_type_title( 'product' ) ),    array( 'class' => 'button', 'data-type' => 'quantity', 'value' => GFCommon::get_field_type_title( 'quantity' ) ),    array( 'class' => 'button', 'data-type' => 'option', 'value' => GFCommon::get_field_type_title( 'option' ) ),    array( 'class' => 'button', 'data-type' => 'shipping', 'value' => GFCommon::get_field_type_title( 'shipping' ) ),    array( 'class' => 'button', 'data-type' => 'total', 'value' => GFCommon::get_field_type_title( 'total' ) ),    array( 'class' => 'button', 'data-type' => 'creditcard', 'value' => GFCommon::get_field_type_title( 'creditcard' ) ),); $field_groups = array(    array( 'name' => 'standard_fields', 'label' => __( 'Standard Fields', 'gravityforms' ), 'fields' => $standard_fields, 'tooltip_class' => 'tooltip_bottomleft' ),    array( 'name' => 'advanced_fields', 'label' => __( 'Advanced Fields', 'gravityforms' ), 'fields' => $advanced_fields ),    array( 'name' => 'post_fields', 'label' => __( 'Post Fields', 'gravityforms' ), 'fields' => $post_fields ),    array( 'name' => 'pricing_fields', 'label' => __( 'Pricing Fields', 'gravityforms' ), 'fields' => $pricing_fields ));

Examples
Example One
This example adds a 「Map」 field button to the advanced group
12345678910111213141516add_filter( 'gform_add_field_buttons', 'add_map_field' );function add_map_field( $field_groups ) {    foreach ( $field_groups as &$group ) {        if ( $group['name'] == 'advanced_fields' ) {            $group['fields'][] = array(                'class'     => 'button',                'data-type' => 'map',                'value'     => __( 'Map', 'gravityforms' ),                'onclick'   => "StartAddField('map');"            );            break;        }    }     return $field_groups;}
Example Two
This example removes the file upload button and the entire post field group from the form editor toolbox
1234567891011121314151617181920212223242526272829303132333435363738add_filter( 'gform_add_field_buttons', 'remove_fields' );function remove_fields( $field_groups ) {    $index                = 0;    $post_field_index     = - 1;    $advanced_field_index = - 1;     //Finding group indexes    foreach ( $field_groups as $group ) {        if ( $group['name'] == 'post_fields' ) {            $post_field_index = $index;        } elseif ( $group['name'] == 'advanced_fields' ) {            $advanced_field_index = $index;        }         $index ++;    }     //removing file upload field    if ( $advanced_field_index >= 0 ) {        $file_upload_index = - 1;        $index             = 0;        foreach ( $field_groups[ $advanced_field_index ]['fields'] as $advanced_field ) {            if ( $advanced_field['value'] == 'File Upload' ) {                $file_upload_index = $index;            }            $index ++;        }         unset( $field_groups[ $advanced_field_index ]['fields'][ $file_upload_index ] );    }     //removing entire post field group    if ( $post_field_index >= 0 ) {        unset( $field_groups[ $post_field_index ] );    }     return $field_groups;}
Example Three
This example updates the onclick attribute of the coupon field.
123456789101112131415add_filter( 'gform_add_field_buttons', function ( $field_groups ) {    foreach ( $field_groups as &$group ) {        if ( $group['name'] == 'pricing_fields' ) {            foreach ( $group['fields'] as &$field ) {                if ( isset( $field['data-type'] ) && $field['data-type'] == 'coupon' ) {                    $field['onclick'] = "StartAddCouponField('coupon');";                    break;                }            }            break;        }    }     return $field_groups;} );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in form_detail.php

gform_activecampaign_tags

gform_activecampaign_tags

DescriptionUsageParametersExamplesPlacementSource CodeSince

Description
This filter can be used to modify the tags which will be added to the contact.
Usage
Applies to all forms:
add_filter( 'gform_activecampaign_tags', 'your_function_name', 10, 4 );

Applies to a specific form:
add_filter( 'gform_activecampaign_tags_4', 'your_function_name', 10, 4 );

Parameters

$tags array
The current tags.

$feed Feed Object
The current feed object.

$entry Entry Object
The current entry object.

$form Form Object
The current form object.

Examples
This example shows how you can add a tag.
add_filter( 'gform_activecampaign_tags', function( $tags, $feed, $entry, $form ) {

$tags[] = 'some tag';

return $tags;
}, 10, 4 );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_activecampaign_tags', $form['id'], $tags, $feed, $entry, $form );

This filter is located in GFActiveCampaign::process_feed() in class-gf-activecampaign.php.
Since
This filter was added in ActiveCampaign 1.2.

gform_activecampaign_supported_field_types_email_map

gform_activecampaign_supported_field_types_email_map

DescriptionUsageParametersExamplesPlacementSource CodeSince

Description
This filter can be used to allow different field types to be mapped to ActiveCampaign』s email field.
Usage
Applies to all forms:
add_filter( 'gform_activecampaign_supported_field_types_email_map', 'your_function_name' );

Parameters

$field_types array | bool
Array of field types or 「true」 for all field types.

Examples
This example shows how you can add a text field type for mapping.
add_filter( 'gform_activecampaign_supported_field_types_email_map', function( $field_types ) {

return array( 'email', 'hidden', 'text' );

} );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$field_types = apply_filters( 'gform_activecampaign_supported_field_types_email_map', array( 'email', 'hidden' ) );

This filter is located in GFActiveCampaign::process_feed() in class-gf-activecampaign.php.
Since
This filter was added in ActiveCampaign 1.5.

gform_activecampaign_note

gform_activecampaign_note

DescriptionUsageParametersExamples1. Customize the note.PlacementSinceSource Code

Description
Filter the note that will be created and associated with the given contact. Supports filtering which contact and/or list the note should be associated with.
Usage
The following would apply to all forms.
1add_filter( 'gform_activecampaign_note', 'your_function_name', 10, 3 );
The following would apply to a specific form.
1add_filter( 'gform_activecampaign_note_FORMID', 'your_function_name', 10, 3 );

Parameters

$note array
Properties that will be used to create and assign the note.

$contact_id int
Contact ID to associate the note with.

$list_id int
List ID to associate the note with.

$note string
Actual note content. HTML will be stripped.

$feed array
Current Active Campaign feed being processed.

$entry array
Current entry being processed.

$form array
Current form being processed.

Examples
1. Customize the note.
The following example shows how you can customize the note.
1234add_filter( 'gform_activecampaign_note', function( $note ) {    $note['note'] = 'My custom note.';    return $note;} );
Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in Gravity Forms Active Campaign 1.6.
Source Code
This filter is located in GFActiveCampaign::process_feed() in includes/class-gf-activecampaign.php.

gform_{$SHORT_SLUG}_field_value

gform_{$SHORT_SLUG}_field_value

DescriptionShort Slug ValuesUsageParametersExamples1. ActiveCampaign – Use Choice Text Instead of Value2. ActiveCampaign – Replace Commas with Pipes3. Emma – Format Checkbox Field4. Help Scout – Change Value of Specific Field5. Zoho CRM – Format Date Field6. Zoho CRM – Format Checkbox FieldPlacementSinceSource Code

Description
This filter can be used to modify a value before it is sent to a third-party by one of the Add-On Framework based add-ons. If you want to filter the value for any add-on you can use gform_addon_field_value.
Short Slug Values
The Gravity Forms Add-On Slugs article lists the available short slugs to use with this hook:
The following add-ons listed in the slug article do not use the hook:

Gravity Forms CLI Add-On
Gravity Forms Debug Add-On
Gravity Forms Gutenberg Add-On

The Zapier Add-On implements its own version of the hook:

gform_zapier_field_value

Usage
The base filter which would run for all forms and all fields would be used like so:
1add_filter( 'gform_helpscout_field_value', 'your_function_name', 10, 4 );
To target a specific form append the form id to the hook name. (format: gform_{$SHORT_SLUG}_field_value_FORMID)
1add_filter( 'gform_helpscout_field_value_10', 'your_function_name', 10, 4 );
To target a specific field append both the form id and the field id to the hook name. (format: gform_{$SHORT_SLUG}_field_value_FORMID_FIELDID)
1add_filter( 'gform_helpscout_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

$value string
The value to be modified.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

$field_id string
The ID of the field currently being processed.

Examples
1. ActiveCampaign – Use Choice Text Instead of Value
This example shows how you can replace the value of a choice based survey field with the choice text.
1234567891011add_filter( 'gform_activecampaign_field_value', 'gf_get_choice_text', 10, 4 );function gf_get_choice_text( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'survey' ) {        $value = $field->get_value_export( $entry, $field_id, true );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }    return $value;}
2. ActiveCampaign – Replace Commas with Pipes
This example shows how you can replace the commas used to separate checkbox or multi select choices with pipe characters.
123456789101112add_filter( 'gform_activecampaign_field_value', 'gf_replace_commas_with_pipes', 10, 4 );function gf_replace_commas_with_pipes( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && ( $field->type == 'checkbox' || $field->type == 'multiselect' ) ) {        $value = str_replace( ', ', '||', $value );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }     return $value;}
3. Emma – Format Checkbox Field
This example shows how you can reformat the checkbox field value to be passed as an array instead of a string.
123456789add_filter( 'gform_emma_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        $value = explode( ', ', $value );    }     return $value;}, 10, 4 );
4. Help Scout – Change Value of Specific Field
This example shows how you can change the value of field 3 on form 10 before it is passed to Help Scout.
1234add_filter( 'gform_helpscout_field_value_10_3', function ( $value, $form, $entry, $field_id ) {     return 'your new value';}, 10, 4 );
5. Zoho CRM – Format Date Field
This example shows how you can reformat the entry date from yyyy-mm-dd to the format configured on the field.
123456789add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'date' ) {        $value = GFCommon::date_display( $value, $field->dateFormat );    }     return $value;}, 10, 4 );
6. Zoho CRM – Format Checkbox Field
This example shows how you can reformat the checkbox field value to pass true or false instead of the choice. This snippet is not needed if you』re using version 1.8 of the add-on or newer.
1234567891011add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    gf_zohocrm()->log_debug( __METHOD__ . '(): Running...' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        gf_zohocrm()->log_debug( __METHOD__ . '(): Checkbox value to true or false.' );        $value = $value ? 'true' : 'false';    }     return $value;}, 10, 4 );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 1.9.10.11.
Source Code
1234gf_apply_filters( "gform_{$slug}_field_value", array(    $form['id'],    $field_id), $field_value, $form, $entry, $field_id );
This filter is located in GFAddOn::maybe_override_field_value() in includes/addon/class-gf-addon.php.

gform_activecampaign_enable_tag_mapping

gform_activecampaign_enable_tag_mapping

DescriptionUsageParametersPlacementSource Code

Description
This filter is used to enable the display of the tags field in the Map Fields section of the ActiveCampaign feed.

This hook was removed in ActiveCampaign 1.2 when the tags mapping setting was removed and replaced by a tags text input with merge tag support.

Usage
add_filter( 'gform_activecampaign_enable_tag_mapping', '__return_true' );

Parameters
This hook has no parameters.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in class-gf-activecampaign.php.

gform_activecampaign_contact_pre_sync

gform_activecampaign_contact_pre_sync

DescriptionUsageParametersExamplesPlacementSource CodeSince

Description
The gform_activecampaign_contact_pre_sync filter can be used to override the contact properties before the contact_sync request is sent to the API.
Usage
The filter which would run for all ActiveCampaign feeds can be used like so:
add_filter( 'gform_activecampaign_contact_pre_sync', 'your_function_name', 10, 4 );

You can limit the scope of the filter to a single form by appending the form id on the end of the hook name like so:
add_filter( 'gform_activecampaign_contact_pre_sync_5', 'your_function_name', 10, 4 );

Parameters

$contact array
The contact properties. See the ActiveCampaign API documentation for the full list of accepted properties.

$entry Entry Object
The entry currently being processed.

$form Form Object
The form object the current entry was created from.

$feed Feed Object
The feed which is currently being processed.

Examples
This example shows how you can add the ip4 property to the array.
add_filter( 'gform_activecampaign_contact_pre_sync', function( $contact, $entry, $form, $feed ) {

$contact['ip4'] = rgar( $entry, 'ip' );

return $contact;
}, 10, 4 );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$contact = apply_filters( 'gform_activecampaign_contact_pre_sync', $contact, $entry, $form, $feed );
$contact = apply_filters( 'gform_activecampaign_contact_pre_sync_' . $form['id'], $contact, $entry, $form, $feed );

This filter is located in GFActiveCampaign::process_feed() in class-gf-activecampaign.php.
Since
This filter was added in ActiveCampaign 1.3.5.

gform_activate_user

gform_activate_user

DescriptionUsageParametersExamplePlacementSource Code

Description
The 「gform_activate_user」 action fires after a user signup has been activated. This action is used in the User Registration plugin for Gravity Forms.
Usage
1add_action( 'gform_activate_user', 'your_function_name, 10, 3 );

Parameters

$user_id int
The user id of the signup user just activated.

$user_data array
An array of the user information.

$signup_meta array
All the metadata in an array (user login, email, password, etc.)

Example
12345add_action( 'gform_activate_user', 'after_user_activate', 10, 3 );function after_user_activate( $user_id, $user_data, $signup_meta ) {    //add note to entry    GFFormsModel::add_note( $signup_meta['lead_id'], $user_id, 'admin', 'The user signup has completed for ' . $user_data['display_name'] . '.');}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This action is located in GF_User_Registration::activate_signup() in gravityformsuserregistration/includes/signups.php.

gform_action_pre_payment_callback

gform_action_pre_payment_callback

DescriptionUsageParametersExamplesSource Code

Description
Runs a function after payment, before the callback occurs.
Usage
1add_action( 'gform_action_pre_payment_callback', 'my_function', 10, 2 );

Parameters

$action array
Array for the payment action triggered.

$entry Entry Object
Entry object for the new entry.

Examples
123456function my_function($action, $entry) {    if( $action['type'] == 'complete_payment' ) {        // Do something    }}add_action( 'gform_action_pre_payment_callback', 'my_function', 10, 2 );
Source Code
1do_action( 'gform_action_pre_payment_callback', $action, $entry );
This action hook is located in GFPaymentAddOn::process_callback_action() in includes/addon/class-gf-payment-addon.php.

GFFeedAddOn

GFFeedAddOn

IntroductionCreating Feed SettingsFeed Settings Fields ExampleDynamic Feed MappingAdding Columns to Feed ListAdding Columns to Feed List ExampleProcessing FeedsImplementing a Feed Condition SettingFeed Condition Field ExamplesAsynchronous Feed ProcessingGFFeedAddOn $_async_feed_processing Propertygform_is_feed_asynchronous FilterFurther ReadingSample Feed Add-On

Introduction

The GFFeedAddOn class provides basic functionality for developers when creating new feed-based add-ons for Gravity Forms. It includes all the features of the GFAddOn class with one exception; the Form Settings are replaced by the Feed Settings UI.

Before reading any further please review the documentation for creating a simple add-on using the GFAddOn class.

Settings APICreating Plugin SettingsIncluding Scripts And Styles When Using The Add-On FrameworkIncluding And Using Entry Meta With The Add-On FrameworkObject LockingCreating a Results PageUninstalling

Creating Feed Settings

The feed settings UI is generated by overriding the feed_settings_fields() function and returning an array with the configuration for each of the fields. The configuration array follows the same structure as the form settings configuration. See the Settings API for further details on the structure of the array.

Feed Settings Fields Example

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142public function feed_settings_fields() {    return array(        array(            'title'  => 'Simple Form Settings',            'fields' => array(                array(                    'label'   => 'My checkbox',                    'type'    => 'checkbox',                    'name'    => 'enabled',                    'tooltip' => 'This is the tooltip',                    'choices' => array(                        array(                            'label' => 'Enabled',                            'name'  => 'enabled'                        )                     )                ),                array(                    'label'   => 'My checkboxes',                    'type'    => 'checkbox',                    'name'    => 'checkboxgroup',                    'tooltip' => 'This is the tooltip',                    'choices' => array(                        array(                            'label' => 'First Choice',                            'name'  => 'first'                        ),                        array(                            'label' => 'Second Choice',                            'name'  => 'second'                        ),                        array(                            'label' => 'Third Choice',                            'name'  => 'third'                        )                    )                ),                array(                    'label'   => 'My Radio Buttons',                    'type'    => 'radio',                    'name'    => 'myradiogroup',                    'tooltip' => 'This is the tooltip',                    'choices' => array(                        array(                            'label' => 'First Choice'                        ),                        array(                            'label' => 'Second Choice'                        ),                        array(                            'label' => 'Third Choice'                        )                    )                ),                array(                    'label'      => 'My Horizontal Radio Buttons',                    'type'       => 'radio',                    'horizontal' => true,                    'name'       => 'myradiogrouph',                    'tooltip'    => 'This is the tooltip',                    'choices'    => array(                        array(                            'label' => 'First Choice'                        ),                        array(                            'label' => 'Second Choice'                        ),                        array(                            'label' => 'Third Choice'                        )                    )                ),                array(                    'label'   => 'My Dropdown',                    'type'    => 'select',                    'name'    => 'mydropdown',                    'tooltip' => 'This is the tooltip',                    'choices' => array(                        array(                            'label' => 'First Choice',                            'value' => 'first'                        ),                        array(                            'label' => 'Second Choice',                            'value' => 'second'                        ),                        array(                            'label' => 'Third Choice',                            'value' => 'third'                        )                    )                ),                array(                    'label'             => 'My Text Box',                    'type'              => 'text',                    'name'              => 'mytext',                    'tooltip'           => 'This is the tooltip',                    'class'             => 'medium',                    'feedback_callback' => array( $this, 'is_valid_setting' )                ),                array(                    'label'   => 'My Text Area',                    'type'    => 'textarea',                    'name'    => 'mytextarea',                    'tooltip' => 'This is the tooltip',                    'class'   => 'medium merge-tag-support mt-position-right'                ),                array(                    'label'   => 'My Hidden Field',                    'type'    => 'hidden',                    'name'    => 'myhidden'                ),                array(                    'label'   => 'My Custom Field',                    'type'    => 'my_custom_field_type',                    'name'    => 'my_custom_field'                ),                array(                    'type'           => 'feed_condition',                    'name'           => 'mycondition',                    'label'          => __( 'Opt-In Condition', 'simplefeedaddon' ),                    'checkbox_label' => __( 'Enable Condition', 'simplefeedaddon' ),                    'instructions'   => __( 'Process this example feed if', 'simplefeedaddon' )                ),            )        ),        array(            'title'  => esc_html__( 'This is the title for Section 1', 'sometextdomain' ),            'fields' => array(                array(                    'name'                => 'metaData',                    'label'               => esc_html__( 'Metadata', 'sometextdomain' ),                    'type'                => 'dynamic_field_map',                    'limit'               => 20,                    'exclude_field_types' => 'creditcard',                    'tooltip'             => '

' . esc_html__( 'Metadata', 'sometextdomain' ) . '

' . esc_html__( 'You may send custom meta information to [...]. A maximum of 20 custom keys may be sent. The key name must be 40 characters or less, and the mapped data will be truncated to 500 characters per requirements by [...]. ', 'sometextdomain' ),                    'validation_callback' => array( $this, 'validate_custom_meta' ),                ),            ),        ),    );}

The code above will render a Form Settings page for the Simple Add-On similar to this:

Dynamic Feed Mapping

Dynamic feed mapping can be used to create fields which automatically map to values in the form. For example, if you need to create a feed that uses information such as a first name and last name, field mapping would be used to map the form fields to those values.

A dynamically mapped field can be implemented just like many of the other feed settings fields and setting the setting field type to dynamic_field_map. Adding a feed section containing dynamically mapped fields would look something like the following:

1234567891011121314array(    'title'  => esc_html__( 'This is the title for Section 1', 'sometextdomain' ),    'fields' => array(        array(            'name'                => 'metaData',            'label'               => esc_html__( 'Metadata', 'sometextdomain' ),            'type'                => 'dynamic_field_map',            'limit'               => 20,            'exclude_field_types' => 'creditcard',            'tooltip'             => '

' . esc_html__( 'Metadata', 'sometextdomain' ) . '

' . esc_html__( 'You may send custom meta information to [...]. A maximum of 20 custom keys may be sent. The key name must be 40 characters or less, and the mapped data will be truncated to 500 characters per requirements by [...]. ', 'sometextdomain' ),            'validation_callback' => array( $this, 'validate_custom_meta' ),        ),    ),)

More information on the dynamic_field_map field type can be found on the dynamic_field_map Field documentation.

Adding Columns to Feed List

To add columns to the list of feeds, override the feed_list_columns() function and return an array of column keys with their corresponding titles. The values will be rendered to the list automatically, but if you need to customize the value just before it is rendered to the list, declare a function with the name get_column_value_[column key] and pass the $feed object as a parameter to the function. The feed object is an associative array with the keys as defined in feed_settings_fields() with the corresponding values for the current row.

Adding Columns to Feed List Example

This example adds two columns to the feed list. The columns are titled 「Name」 and 「My Textbox」. The get_column_value_mytext function returns the value for the 「mytext」 field as bold text.

1234567891011protected function feed_list_columns() {    return array(        'feedName' => __( 'Name', 'simplefeedaddon' ),        'mytext'   => __( 'My Textbox', 'simplefeedaddon' )    );} // customize the value of mytext before it is rendered to the listpublic function get_column_value_mytext( $feed ){    return '' . rgars( $feed, 'meta/mytext' ) . '';}

The code above will render a Feed List page similar to the following:

Processing Feeds

Override the process_feed() method to add code to handle feed processing, such as passing the form entry values to a third-party service.

1public function process_feed( $feed, $entry, $form ) {}

We recommend using get_field_value() to retrieve the entry value for a mapped field e.g.

1$email = $this->get_field_value( $form, $entry, $feed['meta']['listFields_email'] );

Implementing a Feed Condition Setting

A feed condition setting is a feed setting that automatically adds an optional conditional logic setting to the feed. The field is configured just like the other fields (see the Settings API) with the the following properties:

type string『feed condition』name stringThe name for the setting.label stringThe label for the feed condition setting.checkbox_label stringThe label that appears to the right of the checkbox used to enable the condition. If this is not set, the default translated string 「Enable Condition」 is used.instructions stringThe instruction text appears above the conditional logic drop downs, is followed by the All/Any drop down selection, and the translated text 「of the following match」. If you do not specify instruction text, the text 「Process this feed if」 is used.

Feed Condition Field Examples

This is a simple example that uses the basic settings to create the feed condition field.

12345array(    'type'  => 'feed_condition',    'name'  => 'sample_condition',    'label' => 'Feed Condition',)

The code above will render the feed condition field as follows:

This example includes setting the checkbox_label and instructions.

1234567array(    'type'           => 'feed_condition',    'name'           => 'mycondition',    'label'          => __( 'Opt-In Condition', 'simplefeedaddon' ),    'checkbox_label' => __( 'Enable Condition', 'simplefeedaddon' ),    'instructions'   => __( 'Process this example feed if', 'simplefeedaddon' ))

The code above will render the feed condition field as follows:

Asynchronous Feed Processing

As of Gravity Forms version 2.2, feeds can be loaded asynchronously. This means that instead of processing all of the feeds at once, the feeds will be loaded individually.

GFFeedAddOn $_async_feed_processing Property

To load a feed asynchronously, set the $_async_feed_processing property within the GFFeedAddOn class to true.

Example:

123class My_Feed_AddOn extends GFFeedAddOn {    public $_async_feed_processing = true;}

gform_is_feed_asynchronous Filter

Example:

1add_filter( 'gform_is_feed_asynchronous'. '__return_true' );

See gform_is_feed_asynchronous

Further Reading

The following articles may also be useful:

Sending Notifications on Custom Events when using the Add-On FrameworkAdding a Note to the Entry when using the Add-On FrameworkAccessing Mapped Field Values During Feed Processing

Sample Feed Add-On

A sample feed add-on is available which demonstrates the basic functions of GFFeedAddOn:

Feed settings including feed conditionsPlugin pagePlugin SettingsScripts and Styles

https://github.com/rocketgenius/simplefeedaddon