gform_include_thousands_sep_pre_format_number

gform_include_thousands_sep_pre_format_number

DescriptionUsageParametersExamples1. All fields and forms2. Specific fieldPlacementSource Code

Description
Use this filter to prevent the thousand separator being included when the number field value is formatted for display in the admin, notifications and confirmations.
Usage
add_filter( 'gform_include_thousands_sep_pre_format_number', 'your_function_name', 10, 2 );

Parameters

$include_separator boolean
Should the thousand separator be included. Default is true.

$field Field Object
The field that is currently being processed.

Examples
1. All fields and forms
This example shows how you can disable the thousand separator for all number fields on all forms.
add_filter( 'gform_include_thousands_sep_pre_format_number', '__return_false' );

2. Specific field
This example shows how you can disable the thousand separator for a specific field.
add_filter( 'gform_include_thousands_sep_pre_format_number', function ( $include_separator, $field ) {
return $field->formId == 20 && $field->id == 45 ? false : $include_separator;
}, 10, 2 );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in the following methods in includes/fields/class-gf-field-number.php:

GF_Field_Number::get_field_input()
GF_Field_Number::get_value_entry_list()
GF_Field_Number::get_value_entry_detail()
GF_Field_Number::get_value_merge_tag()

gform_include_bom_export_entries

gform_include_bom_export_entries

DescriptionUsageParametersPlacementSource Code

Description
Allows the BOM character to be excluded from the beginning of entry export files.
Usage
The following would apply to all forms.
1add_filter( 'gform_include_bom_export_entries', 'your_function_name' );

Parameters

$include_bom bool
Whether or not to include the BOM characters. Defaults to true.

$form Form Object
The current form.

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

gform_import_form_xml_options

gform_import_form_xml_options

DescriptionUsageParametersExamplesSource Code

Description
Modify the settings used to import a form from an XML export file. Useful when adding your own field types with custom settings stored as an array.
Usage
add_filter( 'gform_import_form_xml_options', 'my_custom_function' );

Parameters

$options array
Array of options for the XML import.

Examples
In this example we demonstrate how to specify that a custom form setting should be unserialized as an array (rather than an object). This assumes that the setting is created in an array format. When the form is exported to XML it will no longer be in array format so on import we need to specify how it should be formatted.
add_filter( 'gform_import_form_xml_options', 'my_custom_import_xml_options' );
function my_custom_import_xml_options( $options ) {
$options['my_custom_form_setting'] = array( 'unserialize_as_array' => true );
return $options;
}

Source Code
This filter is located in GFExport::import_xml() in export.php.

gform_icontact_request_args

gform_icontact_request_args

DescriptionUsageParametersExamplesSource Code

Description
Filter the options array so that is modifiable before sending requests to iContact.
Usage
add_filter( 'gform_icontact_request_args', 'my_function', 10, 4 );

Parameters

$options array
Query arguments to be sent in the request.

$action string
The action being sent to the iContact API, passed in the URL.

$method string
The request method being used. Example: GET.

$return_key string
The array key desired from the response.

Examples
function my_function( $options, $action, $method, $return_key ) {
//Do something here
return $options;
}
add_filter( 'gform_icontact_request_args', 'my_function', 10, 4 );

Source Code
This action hook is located in class-icontact.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_hubspot_submission_data

gform_hubspot_submission_data

DescriptionUsageParametersExampleChange value for pageNameRemove cookie valueCustom cookie valuePlacementSinceSource Code

Description

Allows the HubSpot submission data to be filtered before being sent to HubSpot.

Usage

The following would apply to all forms:

1add_filter( 'gform_hubspot_submission_data', 'your_function_name', 10, 4 );

To target a specific form, append the form id to the hook name. (format: gform_hubspot_submission_data_FORMID):

1add_filter( 'gform_hubspot_submission_data_1', 'your_function_name', 10, 4 );

Parameters

$submission_data array
The HubSpot submission data to be filtered. For more information about the data in this array, see HubSpot』s documentation.

$feed Feed Object
The current feed.

$entry Entry Object
The current entry.

$form Form Object
The current form.

Example

Change value for pageName

12345add_filter( 'gform_hubspot_submission_data', 'change_hubspot_submission_data', 10, 4 );function change_hubspot_submission_data( $submission_data, $feed, $entry, $form ){    $submission_data['context']['pageName'] = 'Testing by Gravity Forms';    return $submission_data;}

Remove cookie value

Using the following example a new contact will be created for each form submission, no matter if a cookie was set by the HubSpot tracking script in the visitor』s browser.

123456add_filter( 'gform_hubspot_submission_data', 'remove_cookie_value', 10, 4 );function remove_cookie_value( $submission_data, $feed, $entry, $form ){    GFCommon::log_debug( __METHOD__ . '(): running.' );    unset( $submission_data['context']['hutk'] );    return $submission_data;}

Custom cookie value

This example shows how you can replace the default cookie created by the HubSpot tracking script with your own custom cookie to define the hutk property.

12345add_filter( 'gform_hubspot_submission_data', 'custom_cookie_value', 10, 4 );function custom_cookie_value( $submission_data, $feed, $entry, $form ){    $submission_data['context']['hutk'] = rgar( $_COOKIE, 'your-cookie-name' );    return $submission_data;}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in HubSpot version 1.0.

Source Code

This filter is located in GF_HubSpot::generate_form_submission_object() in class-gf-hubspot.php.

gform_hubspot_output_tracking_script

gform_hubspot_output_tracking_script

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows the tracking script to be removed.
Usage
1add_filter( 'gform_hubspot_output_tracking_script', 'your_function_name', 10, 1 );

Parameters

$add_tracking bool
Whether to output the tracking script. The default is true.

Example
12345add_filter( 'gform_hubspot_output_tracking_script', 'turn_tracking_off', 10, 1 );function turn_tracking_off( $add_tracking ){    GFCommon::log_debug( __METHOD__ . '(): running.' );    return false;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in HubSpot version 1.0.
Source Code
This filter is located in GF_HubSpot::action_wp_footer in class-gf-hubspot.php.

gform_hubspot_form_object_pre_save_feed

gform_hubspot_form_object_pre_save_feed

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows the HubSpot form object to be filtered before saving the feed.
Usage
The following would apply to all forms:
1add_filter( 'gform_hubspot_form_object_pre_save_feed', 'your_function_name', 10, 3 );
To target a specific form, append the form id to the hook name. (format: gform_hubspot_form_object_pre_save_feed_FORMID)
1add_filter( 'gform_hubspot_form_object_pre_save_feed_1', 'your_function_name', 10, 3 );

Parameters

$hs_form array
The HubSpot form object to be filtered. See HubSpot』s documentation for more information about what data is used in the array.

$feed_meta array
The meta from the current Feed Object.

$form Form Object
The current form.

Example
12345add_filter( 'gform_hubspot_form_object_pre_save_feed', 'change_hubspot_feed', 10, 3 );function change_hubspot_feed( $hs_form, $feed_meta, $form ){    $hs_form['submitText'] = 'Submit the Form';    return $hs_form;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in HubSpot version 1.0.
Source Code
This filter is located in GF_HubSpot::generate_hubspot_form_object() in class-gf-hubspot.php.

gform_hubspot_custom_settings

gform_hubspot_custom_settings

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows custom settings to be added to the Feed Settings page for custom properties created in HubSpot of the types: Single checkbox, Multiple checkboxes, Radio select, Dropdown select. This allows the data to be collected within the form.
This filter does not allow for mapping Gravity Forms fields to the added custom settings, it is used to add additional settings like the default 「Lead Status」 and 「Lifecycle Stage」 dropdowns to the HubSpot feed settings that pull in static values you have defined in HubSpot used for organizing your contacts when they are created by requests from the HubSpot add-on.
Usage
1add_filter( 'gform_hubspot_custom_settings', 'your_function_name', 10, 2 );

Parameters

$custom_settings string
The HTML for the custom settings. Defaults to Lead Status and Lifecycle Stage.

$form Form Object
The current form.

Example
12345add_filter( 'gform_hubspot_custom_settings', 'add_hubspot_property', 10, 2 );function add_hubspot_property( $custom_settings, $form ){    $custom_settings['gravity_forms_key_test'] = array( 'allows_blank' => true, 'tooltip' => esc_html__( '

License Key

Gravity Forms License Key', 'gravityformshubspot' ) );    return $custom_settings;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in HubSpot version 1.0.
Source Code
This filter is located in GF_HubSpot::get_enumeration_properties() in class-gf-hubspot.php.

gform_html_message_template_pre_send_email

gform_html_message_template_pre_send_email

UsageParametersSource

The 「gform_html_message_template_pre_send_email」 filter in Gravity Forms allows the template for the HTML-formatted message to be overridden.

Usage

123456789101112131415add_filter( 'gform_html_message_template_pre_send_email', 'notification_template' ); function notification_template( $template ) {    $template = '                                    {subject}                                        {message}                    ';     return $template;}

Parameters

$template
string

The template for the html formatted message. Use {message} and {subject} as placeholders.

Source

common.php