gform_enable_password_field

gform_enable_password_field

DescriptionUsageParametersExamplesSource Code

Description
Use this filter to enable the password field. Useful when developing add-ons that require a password field.
Usage
add_filter( 'gform_enable_password_field', '__return_true' );

Parameters

$is_enabled bool
Value to be filtered. True enables the password field; false disables it.

Examples
This example enables the password field.
add_filter( 'gform_enable_password_field', '__return_true' );

Source Code
This action hook is located in form_detail.php.

gform_enable_legacy_markup

gform_enable_legacy_markup

DescriptionUsageParametersExamples1. Enable legacy markup for all forms2. Disable legacy markup for all formsPlacementSinceSource Code

Description
The gform_enable_legacy_markup filter can be used to enable the legacy markup for forms created with Gravity Forms 2.5 and greater.
Usage
add_filter( 'gform_enable_legacy_markup', 'your_function_name', 10, 2 );

You can also specify this per form by adding the form id after the filter name.
add_filter( 'gform_enable_legacy_markup_6', 'your_function_name', 10, 2 );

Parameters

$is_enabled boolean
Indicates if legacy markup is enabled for the current form. Default is false for forms created with Gravity Forms 2.5 and greater.

$form Form Object
The current form object.

Examples
1. Enable legacy markup for all forms
add_filter( 'gform_enable_legacy_markup', '__return_true' );

2. Disable legacy markup for all forms
add_filter( 'gform_enable_legacy_markup', '__return_false' );

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 v2.5.
Source Code
This filter is located in GFCommon::is_legacy_markup_enabled() in common.php.

gform_enable_field_label_visibility_settings

gform_enable_field_label_visibility_settings

DescriptionUsageParametersPlacementSource Code

As of Gravity Forms 2.4, this functionality is part of the Form Editor and the hook has been deprecated.

Description
This filter is used to enable the inclusion of the hidden choice in the Field Label Visibility and Sub-Label Placement settings on the field Appearance tab in the form editor.
Please bear in mind that hiding the field label will impact the accessibility of your form for users with visual impairments.
Usage
1add_filter( 'gform_enable_field_label_visibility_settings', '__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 GFFormDetail::forms_page() in form_detail.php

gform_enable_entry_info_payment_details

gform_enable_entry_info_payment_details

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_enable_entry_info_payment_details」 action enables the payment details panel for the current entry.

Removed: This hook was removed in version 2.0 with no replacement. The payment/subscription details panel is now displayed automatically if the entry payment status is set.

Usage
1add_action( 'gform_enable_entry_info_payment_details', 'my_function', 10, 2 );

Parameters

$is_enabled bool
Returns true if the payment info details are enabled for the entry.

$entry object
Entry object for the displayed entry.

Examples
1234567function my_function($is_enabled, $entry) {    if( ! empty( $entry['payment_status'] ) ) {        // Do something    }    return true;}add_action( 'gform_enable_entry_info_payment_details', 'my_function', 10, 2 );
Source Code
This action hook is located in entry_detail.php

gform_enable_credit_card_field

gform_enable_credit_card_field

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to enable/disable the built-in credit card field.

Note: The credit card field is only intended for use with a payment gateway add-on as the field values are not saved during form submission.

Usage
add_filter( 'gform_enable_credit_card_field', '__return_true', 11 );

Parameters

$is_enabled bool
Value to be filtered. Use 「true」 to enable the credit card field. Use 「false」 to disable it.

Examples
This example enables the credit card field for all forms. Add the field to the form in the Form Editor.
add_filter( 'gform_enable_credit_card_field', 'enable_creditcard', 11 );
function enable_creditcard( $is_enabled ) {
return true;
}

Placement
This code should be placed in the functions.php file of your active theme or a custom functionality plugin.
Source Code
This filter is located in form_detail.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_email

gform_email

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter is executed when creating the email field and can be used to modify the 「Email」 label.
Usage
Applies to all forms.
add_filter( 'gform_email', 'change_email', 10, 2 );

Applies to a specific form. In this case, form id 5.
add_filter( 'gform_email_5', 'change_email', 10, 2 );

Parameters

$label string
The label to be filtered.

$form_id integer
The current form』s id.

Examples
This example changes the default email label:
add_filter( 'gform_email', 'change_email', 10, 2 );
function change_email( $label, $form_id ) {
return 'Your Email';
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Field_Email::get_field_input() in includes/fields/class-gf-field-email.php.

gform_email_fields_notification_admin

gform_email_fields_notification_admin

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use the filter to add/remove fields from the list of email fields that get displayed on the Notification edit page when configuring the 「Send To Field」.
Usage
add_filter( 'gform_email_fields_notification_admin', 'add_field_to_email_list', 10, 2 );

Applies to a specific form. In this case, form id 5.
add_filter( 'gform_email_fields_notification_admin_5', 'add_field_to_email_list', 10, 2 );

Parameters

$field_list array
And array of Field Objects to be displayed in the drop down.

$form Form Object
The current form.

Examples
The following example adds a field (field with ID=1) to the list of email fields displayed in the drop down.
add_filter( 'gform_email_fields_notification_admin', 'add_field_to_email_list', 10, 2 );
function add_field_to_email_list( $field_list, $form ) {

//Adds field with ID=1 to the list of email fields
foreach ( $form['fields'] as $field ) {
if ( $field->id == '1' ) {
$field_list[] = $field;
break;
}
}

return $field_list;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFNotification::get_notification_ui_settings() in notification.php.

gform_email_confirm

gform_email_confirm

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter is executed when creating the email field and can be used to modify the 「Confirm Email」 label.
Usage
Applies to all forms.
1add_filter( 'gform_email_confirm', 'change_email_confirm', 10, 2 );
Applies to a specific form. In this case, form id 5.
1add_filter( 'gform_email_confirm_5', 'change_email_confirm', 10, 2 );
Parameters

$label string
The label to be filtered.

$form_id integer
The current form』s id.

Examples
This example changes the default confirm email label:
1234add_filter( 'gform_email_confirm', 'change_email_confirm', 10, 2 );function change_email_confirm( $label, $form_id ) {    return 'Confirm Your Email';}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Field_Email::get_field_input() in includes/fields/class-gf-field-email.php.

gform_email_background_color_label

gform_email_background_color_label

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows the background color for the field label in the html email to be changed.
Usage
add_filter( 'gform_email_background_color_label', 'your_function_name', 10, 3 );

Parameters

$color string
The current background color. The default is #EAF2FA.

$field Field Object
The current field.

$entry Entry Object
The current entry.

Example
add_filter( 'gform_email_background_color_label', 'set_email_label_color', 10, 3 );
function set_email_label_color( $color, $field, $lead ){
return '#CC99FF';
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 1.8.6.
Source Code
This filter is located in GFCommon::get_submitted_fields() in common.php.