gform_email_background_color_data

gform_email_background_color_data

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows the background color for the field data in the html email to be changed.
Usage
1add_filter( 'gform_email_background_color_data', 'your_function_name', 10, 3 )

Parameters

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

$field Field Object
The current field.

$entry Entry Object
The current entry.

Example
1234add_filter("gform_email_background_color_data", "set_email_data_color", 10, 3);        function set_email_data_color( $color, $field, $entry ){            return "#CCCCFF";        }
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_editor_sidebar_panels

gform_editor_sidebar_panels

DescriptionUsageParametersExamples1. Add a new panelPlacementSinceSource Code

Description
The gform_editor_sidebar_panels filter enables custom panels to be registered for display in the form editor sidebar. Use the gform_editor_sidebar_panel_content action hook to echo the panel content.
Usage
The filter which would run for all forms would be used like so:
add_filter( 'gform_editor_sidebar_panels', 'your_function_name', 10, 2 );

You can also target a specific form by adding the form id after the hook name.
add_filter( 'gform_editor_sidebar_panels_6', 'your_function_name', 10, 2 );

Parameters

$panels array
An array of custom sidebar panels.

$form Form Object
The form currently being edited.

Examples
1. Add a new panel
add_filter( 'gform_editor_sidebar_panels', function ( $panels, $form ) {
$panels[] = array(
// Define the unique ID for your panel.
'id' => 'my_custom_panel_1',
// Define the title to be displayed on the toggle button your panel.
'title' => 'My Custom Panel',
// Define an array of classes to be added to the toggle button for your panel.
'nav_classes' => array( 'my_nav_class_1', 'my_nav_class_2' ),
// Define an array of classes to be added to the body of your panel.
'body_classes' => array( 'my_body_class_1' ),
);

return $panels;
}, 10, 2 );

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 GFFormDetail::forms_page() in form_detail.php

gform_editor_sidebar_panel_content

gform_editor_sidebar_panel_content

DescriptionUsageParametersExamples1. Add a new panelPlacementSinceSource Code

Description
The gform_editor_sidebar_panel_content action hook is used to echo the content for a custom panel in the form editor sidebar. Use the gform_editor_sidebar_panels filter to register the panel.
Usage
The base action which would run for all forms and all custom tabs would be used like so:
add_action( 'gform_editor_sidebar_panel_content', 'your_function_name', 10, 2 );

You can target a specific tab by adding the tab id after the hook name.
add_action( 'gform_editor_sidebar_panel_content_thepanelid', 'your_function_name', 10, 2 );

You can target a specific tab and form by adding the id』s after the hook name.
add_action( 'gform_editor_sidebar_panel_content_thepanelid_6', 'your_function_name', 10, 2 );

Parameters

$panel array
The properties of the panel being displayed.

$form Form Object
The form currently being edited.

Examples
1. Add a new panel
add_action( 'gform_editor_sidebar_panel_content_my_custom_panel_1', function ( $panel, $form ) {
echo 'the content of my custom panel.';
}, 10, 2 );

Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This action hook was added in Gravity Forms v2.5.
Source Code
This action hook is located in GFFormDetail::forms_page() in form_detail.php

gform_editor_js

gform_editor_js

DescriptionUsageExamples1. Basic example2. Adding a custom setting to all field types3. Set default date formatSource Code

Description
This action hook can be used to inject Javascript into the form editor page.
Usage
add_action( 'gform_editor_js', 'editor_script' );

Examples
1. Basic example
add_action( 'gform_editor_js', 'editor_script' );
function editor_script(){
echo '';
}

2. Adding a custom setting to all field types
This example adds a custom setting, which has been implemented using gform_field_standard_settings, gform_field_appearance_settings, or gform_field_advanced_settings, to the fields.
add_action( 'gform_editor_js', function () {
echo '' . PHP_EOL;
} );

3. Set default date format
This example sets the default date format for date type fields to dmy_dot.
add_action( 'gform_editor_js', function () {
echo '' . PHP_EOL;
} );

Source Code
This filter is located in js.php.

gform_editor_js_set_default_values

gform_editor_js_set_default_values

DescriptionUsageExamplesSource Code

Description
This action hook can be used to inject Javascript into the SetDefaultValues() function on the form editor page. Use this hook to define default field properties when creating new field types.
Usage
add_action( 'gform_editor_js_set_default_values', 'set_defaults' );

Examples
This example changes the default label for a new field type:
add_filter( 'gform_add_field_buttons', 'add_new_field' );
function add_new_field( $field_groups ) {
//Adds a new field to the end of the standard fields list
$field_groups[0]['fields'][] = array( "class"=>"button", "value" => 'My Field', "onclick" => "StartAddField('my_field_type');" );
return $field_groups;
}

add_action( 'gform_editor_js_set_default_values', 'set_defaults' );
function set_defaults(){
?>
//this hook is fired in the middle of a switch statement,
//so we need to add a case for our new field type
case "my_field_type" :
field.label = "My Default Field Label"; //setting the default field label
break;

Source Code
This filter is located in js.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_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_duplicate_field

gform_duplicate_field

DescriptionUsageParametersExample(s)PlacementSinceSource Code

Description
The 「gform_duplicate_field」 JavaScript filter in Gravity Forms allows the field being duplicated in the Form Editor to be modified.
Usage
The following would apply to all field input types:
1gform.addFilter('gform_duplicate_field', 'change_duplicate' );
To target a specific type of field, append the field input type (ie: text, select, radio) to the hook name. (format: gform_duplicate_field_FIELDTYPE)
1gform.addFilter('gform_duplicate_field_text', 'change_duplicate' );

Parameters

field Field Object
The Field Object.

form Form Object
The Form Object.

Example(s)
This example uses the gform_admin_pre_render filter to load the hook and set the label of the field being duplicated to 『Duplicated Field』.
12345678910111213add_action( 'gform_admin_pre_render', 'add_duplicate_filter' );function add_duplicate_filter( $form ) {    ?>        

gform_dropdown_no_results_text

gform_dropdown_no_results_text

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to change the default 「No Results」 placeholder text on Drop Down fields when using the enhanced user interface.
Usage
add_filter( 'gform_dropdown_no_results_text', 'set_no_results_text', 10, 2 );

You can also target a specific form by adding the form id after the hook name.
add_filter( 'gform_dropdown_no_results_text_6', 'set_no_results_text', 10, 2 );

Parameters

$text string
The text to be filtered.

$form_id integer
ID of current form.

Examples
This example changes the no results text to 「No results found」.
add_filter( 'gform_dropdown_no_results_text_185', 'set_no_results_text', 10, 2 );
function set_no_results_text( $text, $form_id ) {
return 'No results found';
}

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

gform_dropbox_store_local_version

gform_dropbox_store_local_version

DescriptionUsageParametersExamples1. Simple Usage2. Advanced UsagePlacementSource Code

Description
This filter can be used to keep a local copy of the file being retained once it has been uploaded to Dropbox.
Usage
The following would apply to all forms:
add_filter( 'gform_dropbox_store_local_version', 'your_function_name', 10, 6 );

To target a specific form append the form id to the hook name. (format: gform_dropbox_store_local_version_FORMID)
add_filter( 'gform_dropbox_store_local_version_10', 'your_function_name', 10, 6 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_dropbox_store_local_version_FORMID_FIELDID)
add_filter( 'gform_dropbox_store_local_version_10_3', 'your_function_name', 10, 6 );

Parameters

$store_local_version boolean
Should a local copy of the file be retained? Default is false.

$file array
The file properties.
array(
'name' => basename( $entry[ rgar( $field, 'id' ) ] ),
'path' => str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $entry[ rgar( $field, 'id' ) ] ),
'url' => $entry[ $field['id'] ],
'destination' => rgars( $feed, 'meta/destinationFolder' ),
);

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

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

$feed Feed Object
The feed currently being processed.

Examples
1. Simple Usage
This example shows the simplest way to use the hook.
add_filter( 'gform_dropbox_store_local_version', '__return_true' );

2. Advanced Usage
This example shows how you can determine if a local copy should be retained based on the name of the feed and a field value in the Entry Object.
add_filter( 'gform_dropbox_store_local_version_10', 'maybe_store_local_version', 10, 6 );
function maybe_store_local_version( $store_local_version, $file, $field_id, $form, $entry, $feed ) {
if ( rgars( $feed, 'meta/feedName') == 'Dropbox Feed 2' && rgar( $entry, '5' ) == 'No' ) {
return true;
}

return $store_local_version;
}

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

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