gform_duplicate_message

gform_duplicate_message

DescriptionUsageParametersExamples1. Use the same message for all fields.2. Use the fields custom validation message.PlacementSource Code

Description
This filter is executed when a form fails the duplicate field validation, before the validation message is displayed. Use this filter to change the the message that is displayed when a field fails the duplicate value validation.
Usage
The following would apply to all fields using the no duplicates feature on all forms.
1add_filter( 'gform_duplicate_message', 'your_function_name', 10, 4 );
To target a specific form append the form id to the hook name. (format: gform_duplicate_message_FORMID)
1add_filter( 'gform_duplicate_message_5', 'your_function_name', 10, 4 );

Parameters

$message string
The validation message to be filtered.

$form Form Object
The current form.

$field Field Object
Current Field object.

$value string
The field value being validated.

Examples
1. Use the same message for all fields.
This changes the default no duplicates validation message.
1234add_filter( 'gform_duplicate_message', 'change_message', 10, 2 );function change_message( $message, $form ) {  return 'This field failed the duplicate value validation. Please enter a different value.';}
2. Use the fields custom validation message.
This example uses the fields custom validation message as the no duplicates validation message.
1234add_filter( 'gform_duplicate_message', function ( $message, $form, $field ) {     return empty( $field->errorMessage ) ? $message : $field->errorMessage;}, 10, 3 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
1gf_apply_filters( 'gform_duplicate_message', $form['id'], $default_message, $form, $field, $value )
This filter is located in GFFormDisplay::validate() in form_display.php

gform_entry_detail_sidebar_after

gform_entry_detail_sidebar_after

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra text/boxes after the last box in the Entry detail sidebar.
Usage
1add_action( 'gform_entry_detail_sidebar_after', 'add_sidebar_text_after', 10, 2 );

Parameters

$form Form Object
The form from which the entry value was submitted.

$entry Entry Object
The current entry.

Examples
This example adds a new box with a header and text.
1234add_action( 'gform_entry_detail_sidebar_after', 'add_sidebar_text_after', 10, 2 );function add_sidebar_text_after( $form, $entry ) {    echo "

More Cool Stuff

text added after!

";}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_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_entries_view

gform_entries_view

DescriptionUsageParametersExamplesSource Code

Description
Triggers when viewing an entry with a non-standard entry type.
Usage
add_action( 'gform_entries_view', 'my_function', 10, 3 );

Parameters

$view string
The current entry type.

$form_id string
The ID of the form that the entry belongs to.

$entry_id string
The ID of the current entry.

Examples
if ( rgget('view') == 'my_view' ) {
add_action( 'gform_entries_view', 'my_function', 10, 3 );
function my_function($view, $form_id, $entry_id) {
//Display the view for this entry type
}
}

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

gform_entries_column_filter

gform_entries_column_filter

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to inject markup and replace the value of any non-first column in the entry list grid.
Usage
add_filter( 'gform_entries_column_filter', 'change_column_data', 10, 5 );

Parameters

$value string
Current value that will be displayed in this cell.

$form_id integer
ID of the current form.

$field_id integer
ID of the field that this column applies to.

$entry Entry Object
Current entry object.

$query_string string
Current page query string with search and pagination state.

Examples
This example replaces the value when the field id is 2 and the form id is 1. Note: This example assumes that field with ID 2 is NOT placed in the first column on the entry grid. This hook does not fire for the first column in the grid. Look at gform_entries_first_column to add content to the first column.
add_filter( 'gform_entries_column_filter', 'change_column_data', 10, 5 );
function change_column_data( $value, $form_id, $field_id, $entry, $query_string ) {
//only change the data when form id is 1 and field id is 2
if ( $form_id != 1 && $field_id != 2 ) {
return $value;
}
return "newdata";
}

This example displays text next to the existing value.
add_filter( 'gform_entries_column_filter', 'change_column_data', 10, 5 );
function change_column_data( $value, $form_id, $field_id, $entry, $query_string ) {
//only change the data when form id is 1 and field id is 2
if ( $form_id != 1 && $field_id != 2 ) {
return $value;
}
return $value . " - newdata";
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This hook is located in GFEntryList::leads_page() in entry_list.php.

gform_editor_field_settings

gform_editor_field_settings

DescriptionUsageParametersExamples1. Remove a settingPlacementSinceSource Code

Description
The gform_editor_field_settings filter allows the editor settings that are used for the current field, including those inherited from the inputType, to be overridden.
Usage
The filter which would run for all forms and fields would be used like so:
gform.addFilter( 'gform_editor_field_settings', function( settingsArray, field ) {
// do stuff

return settingsArray;
} );

Parameters

settingsArray array
The current settings for the field. See Field Settings for available settings.
[
".conditional_logic_field_setting",
".prepopulate_field_setting",
".error_message_setting",
".label_setting",
".label_placement_setting",
".admin_label_setting",
".size_setting",
".input_mask_setting",
".maxlen_setting",
".password_field_setting",
".rules_setting",
".visibility_setting",
".duplicate_setting",
".default_value_setting",
".placeholder_setting",
".description_setting",
".css_class_setting",
".autocomplete_setting"
]

field Javascript Object | Field Object
The field being modified.

Examples
1. Remove a setting
This example shows how a setting can be removed from a specific field type.
gform.addFilter( 'gform_editor_field_settings', function( settings, field ) {
if ( field.type !== 'quiz' ) {
return settings;
}

// Find the index of the choices setting
var i = settings.indexOf( '.choices_setting' );

// Doesn't exist; bail.
if ( i === -1 ) {
return settings;
}

// Remove the choices_setting value.
settings.splice( i, 1 );

return settings;
} );

Placement
This code should be placed in a JavaScript file included in the admin by your plugin.
Since
This filter was added in Gravity Forms v2.5.
Source Code
This filter is located in getAllFieldSettings() in form_editor.js.

gform_entry_detail_sidebar_before

gform_entry_detail_sidebar_before

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra text/boxes before the first box in the Entry detail sidebar.
Usage
add_action( 'gform_entry_detail_sidebar_before', 'add_sidebar_text_before', 10, 2 );

Parameters

$form Form Object
The form from which the entry value was submitted.

$entry Entry Object
The current entry.

Examples
This example adds a new box with a header and text.
add_action( 'gform_entry_detail_sidebar_before', 'add_sidebar_text_before', 10, 2 );
function add_sidebar_text_before( $form, $entry ) {
echo "

Extra Cool Stuff

text added before!

";
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_detail.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_dropbox_should_upload_file

gform_dropbox_should_upload_file

DescriptionUsageParametersExamples1. Log the paramsPlacementSinceSource Code

Description

The gform_dropbox_should_upload_file filter can be used to determine if a file for a fileupload or dropbox type field is uploaded to Dropbox.

Usage

The following would apply to all forms:

add_filter( 'gform_dropbox_should_upload_file', 'your_function_name', 10, 7 );

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

add_filter( 'gform_dropbox_should_upload_file_2', 'your_function_name', 10, 7 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_dropbox_should_upload_file_FORMID_FIELDID)

add_filter( 'gform_dropbox_should_upload_file_2_3', 'your_function_name', 10, 7 );

Parameters

$should_upload_file booleanIndicates if the file should be uploaded to Dropbox.$url stringThe URL of the file from the entry.$existing false|arrayFalse or an array of files previously uploaded to Dropbox for the current field and entry.$field Field ObjectThe current fileupload or dropbox field object$form Form ObjectThe form containing the current field.$entry Entry ObjectThe entry currently being processed.$feed Feed ObjectThe feed currently being processed.

Examples

1. Log the params

This is a basic usage example showing how you can log the parameters available to this filter.

add_filter( 'gform_dropbox_should_upload_file', 'log_gform_dropbox_should_upload_file', 10, 7 );
add_filter( 'gform_dropbox_should_upload_file_18', 'log_gform_dropbox_should_upload_file', 10, 7 );
add_filter( 'gform_dropbox_should_upload_file_18_6', 'log_gform_dropbox_should_upload_file', 10, 7 );
function log_gform_dropbox_should_upload_file( $should_upload_file, $url, $existing, $field, $form, $entry, $feed ) {
gf_dropbox()->log_debug( current_filter() . ': ' . print_r( func_get_args(), true ) );

return $should_upload_file;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom functions plugin, or your custom add-on.

Since

This filter was added in version 3.0.1.

Source Code

public function should_upload_file( $url, $existing, $field, $form, $entry, $feed ) {
if ( ! empty( $existing ) ) {
$should_upload_file = ! in_array( $url, $existing );
} else {
// The preview link type uses www.dropbox.com.
$should_upload_file = $field instanceof GF_Field_Dropbox && $field->get_link_type( $form ) === 'preview' || stripos( $url, 'www.dropbox.com' ) === false;
}

$filter_args = array( 'gform_dropbox_should_upload_file', $form['id'], $field->id );

if ( function_exists( 'gf_has_filters' ) && gf_has_filters( $filter_args ) ) {
$this->log_debug( __METHOD__ . '(): Executing functions hooked to gform_dropbox_should_upload_file.' );
}

/**
* Provides a way to prevent the uploading of a file to Dropbox.
*
* @since 3.1
*
* @param bool $should_upload_file Indicates if the file should be uploaded to Dropbox.
* @param string $url The URL of the file from the entry.
* @param false|array $existing False or an array of files previously uploaded to Dropbox for the current field and entry.
* @param GF_Field $field The current fileupload or dropbox field object.
* @param array $form The current form object.
* @param array $entry The current entry object.
* @param array $feed The current feed object.
*/
return (bool) gf_apply_filters( $filter_args, $should_upload_file, $url, $existing, $field, $form, $entry, $feed );
}

This filter is located in GFDropbox::should_upload_file() in class-gf-dropbox.php.