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_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_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_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_add_meta()

gform_add_meta()

DescriptionUsageParametersExamplesSource Code

Description
The function 「gform_add_meta()」 adds the metadata associated with an entry in the Entry Meta table. The data will be serialized.
Usage
gform_add_meta( $entry_id, $meta_key, $meta_value, $form_id = null );

Parameters

$entry_id integer
The ID of the entry.

$meta_key string
The meta key of the meta value you wish to add.

$meta_value string
The value to be set as the new value for the specified meta key.

$form_id integer
The form ID of the entry. Optional (saves extra query if passed when creating the metadata).

Examples
This example inserts a value for a new meta key.
//inserts "This is test data" for the meta key "my_test_key" for entry id 14 for form id 1.
gform_add_meta(14, 'my_test_key', 'This is test data.', 1);

Source Code
This function is located in forms_model.php

gform_addnote_button

gform_addnote_button

DescriptionUsageParametersExamplesPlacementSource Code

Description
The 「gform_addnote_button」 filter in Gravity Forms allows modification of the HTML of the 「Add Note」 button for Entry Notes on the Entry Detail page.
Usage
1add_filter( 'gform_addnote_button', 'your_function_name', 10, 1 );

Parameters

$note_button string
The HTML for the 「Add Note」 Button.

Examples
12345add_filter( 'gform_addnote_button', 'change_button', 10, 1 );function change_button( $note_button ){    $note_button = '';    return $note_button;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::notes_grid() in entry_detail.php.

gform_addon_app_PAGE_TAB

gform_addon_app_PAGE_TAB

DescriptionUsageParametersPlacementSource Code

Description
This action fires when a page and tab is accessed within Gravity Forms.
Typically used to add content to custom settings tabs.
Usage
add_action( 'gform_addon_app_PAGE_TAB', 'your_function_name' );

Parameters
No parameters are provided for this action.

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This hook is located in class-gf-addon.php.

gform_addon_app_settings_menu_{$SHORT_SLUG}

gform_addon_app_settings_menu_{$SHORT_SLUG}

DescriptionUsageParametersPlacementSource Code

Description
The 「gform_addon_app_settings_menu_」 plus {$SHORT_SLUG} filter in Gravity Forms controls the addition or removal of tabs within the Gravity Forms settings menu.
Usage
The Gravity Forms Add-On Slugs lists the short slugs for the available add-ons.
The following would add a settings tab and determine the callback for the defined slug:
add_filter( 'gform_addon_app_settings_menu_{$SHORT_SLUG}', 'your_function_name' );

The following would run for the Mailchimp add-on:
add_filter( 'gform_addon_app_settings_menu_mailchimp', 'your_function_name' );

The following would run for the 2Checkout add-on:
add_filter( 'gform_addon_app_settings_menu_2checkout', 'your_function_name' );

Parameters

$settings_tabs array
Any existing settings tabs. Controls each of the tabs and the callback.

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in class-gf-addon.php.

gform_addon_feed_settings_fields

gform_addon_feed_settings_fields

DescriptionUsageParametersExamples1. Add a Custom Setting to the First Section of All Feeds2. Add a Custom Setting After the 「Send Email」 Setting for All User Registration Feeds3. Remove 『Password』 Setting for User Registration Feeds for a Specific Form4. Add a Custom Setting to Certain Payment Add-OnsFurther ReadingPlacementSource CodeSince

Description
Filter the feed settings fields (typically before they are rendered on the Feed Settings edit view).
Usage
The base filter which would run for all add-on feeds would be used like so:
add_filter( 'gform_addon_feed_settings_fields', 'your_function_name', 10, 2 );

You can target a specific add-on with the following variation of this hook:
add_filter( 'gform_{ADDON_SLUG}_feed_settings_fields', 'your_function_name', 10, 2 );

See the Gravity Forms Add-On Slugs article for a list of possible slugs.

Parameters

$feed_settings_fields array
An array of feed settings fields which will be displayed on the Feed Settings edit view. See the Settings API for further details on the structure of the array.

$addon object
The current instance of the GFAddon object which extends GFFeedAddOn or GFPaymentAddOn (i.e. GFCoupons, GF_User_Registration, GFStripe).

Examples
1. Add a Custom Setting to the First Section of All Feeds
add_filter( 'gform_addon_feed_settings_fields', 'add_custom_addon_setting', 10, 2 );
function add_custom_addon_setting( $feed_settings_fields, $addon ) {

$feed_settings_fields[0]['fields'][] = array(
'name' => 'my_custom_setting',
'label' => 'My Custom Setting',
'type' => 'text'
);

return $feed_settings_fields;
}

2. Add a Custom Setting After the 「Send Email」 Setting for All User Registration Feeds
This example shows how the add_field_after() helper can be used to add a new setting after a specific existing setting.
add_filter( 'gform_gravityformsuserregistration_feed_settings_fields', function( $feed_settings_fields, $addon ) {

$feed_settings_fields = $addon->add_field_after( 'sendEmail', array(
array(
'name' => 'my_custom_setting',
'label' => 'My Custom Setting',
'type' => 'text'
)
), $feed_settings_fields );

return $feed_settings_fields;
}, 10, 2 );

3. Remove 『Password』 Setting for User Registration Feeds for a Specific Form
This example shows how the remove_field() helper can be used to remove one of the settings.
add_filter( 'gform_gravityformsuserregistration_feed_settings_fields', function( $feed_settings_fields, $addon ) {

$form = $addon->get_current_form();
if( $form['id'] == 1 ) {
$feed_settings_fields = $addon->remove_field( 'password', $feed_settings_fields );
}

return $feed_settings_fields;
}, 10, 2 );

4. Add a Custom Setting to Certain Payment Add-Ons
This example shows how an add-on which uses the Add-On Framework, in this example it』s the User Registration Add-On, can add a custom setting to add-ons which extend GFPaymentAddOn and support subscription cancellations.
public function init() {
parent::init();
add_filter( 'gform_addon_feed_settings_fields', array( $this, 'add_subscription_feed_setting' ), 10, 2 );
}
public function add_subscription_feed_setting( $feed_settings_fields, $addon ) {
$addon_supports_subscriptions = $addon instanceof GFPaymentAddOn && $addon->method_is_overridden( 'cancel', 'GFPaymentAddOn' );

if ( $addon_supports_subscriptions ) {

$ur_settings = array(
'title' => esc_html__( 'User Registration Options', 'gravityformsuserregistration' ),
'tooltip' => sprintf( '

%s

%s', esc_html__( 'User Registration Options', 'gravityformsuserregistration' ), esc_html__( 'The selected form also has a User Registration feed. These options allow you to specify how you would like the PayPal and User Registration Add-ons to work together.', 'gravityformuserregistration' ) ),
'fields' => array(),
'dependency' => array( 'field' => 'transactionType', 'values' => array( 'subscription' ) ),
);

$ur_settings['fields'][] = array(
'name' => 'cancellationActionUser',
'label' => esc_html__( 'Update User on Cancel', 'gravityformsuserregistration' ),
'type' => 'checkbox_and_select',
'checkbox' => array(
'label' => esc_html__( 'Update user when subscription is cancelled.', 'gravityformsuserregistration' )
),
'select' => array(
'choices' => $this->get_update_user_actions_choices()
),
);

$feed_settings_fields = array_merge( $feed_settings_fields, array( $ur_settings ) );
}

return $feed_settings_fields;
}

Further Reading
For more details on adding and removing fields from the settings, see the Helper Functions article.
The Settings API category includes a number of examples showing how you can implement various field types.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFeedAddOn::get_feed_settings_fields() in /includes/addons/class-gf-feed-addon.php.
Since
This filter was added in Gravity Forms 2.0.

gform_addon_field_map_choices

gform_addon_field_map_choices

DescriptionUsageParametersExamples1. Add new choice to all add-onsPlacementSource CodeSince

Description
The gform_addon_field_map_choices filter can be used to override the choices available in the field map drop down.
This filter is depreacted since version 2.5. Use the gform_field_map_choices filter instead.
Usage
Generic: applies to all add-ons and all forms.
1add_filter( 'gform_addon_field_map_choices', 'your_function_name', 10, 3 );
Addon-specific: applies to a specific add-on for all forms. Requires a minimum PHP version of 5.3.
1add_filter( 'gform_{ADDON_SLUG}_field_map_choices', 'your_function_name', 10, 3 );
See the Gravity Forms Add-On Slugs article for a list of possible slugs.

Parameters

$fields array
The value and label properties for each choice.

$form_id integer
The ID of the form currently being configured.

$field_type null | array
Null or the field types to be included in the drop down.

$exclude_field_types null | array | string
Null or the field type(s) to be excluded from the drop down.

Examples
1. Add new choice to all add-ons
12345add_filter( 'gform_addon_field_map_choices', function( $fields, $form_id, $field_type, $exclude_field_types ) {    $fields[] = array( 'label' => 'The new choice', 'value' => 'new_choice' );     return $fields;}, 10, 4 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFAddOn::get_field_map_choices() in /includes/addon/class-gf-addon.php.
Since
This filter was added in Gravity Forms 2.0.7.11.