gform_entry_pre_handle_confirmation

gform_entry_pre_handle_confirmation

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows the entry to be modified before the confirmation is processed.
Usage
add_filter( 'gform_entry_pre_handle_confirmation', 'your_function_name', 10, 2 );

Parameters

$entry Entry Object
The current entry.

$form Form Object
The current form.

Example
add_filter( 'gform_entry_pre_handle_confirmation', 'change_entry', 10, 2 );
function change_entry( $entry, $form ){
if ( rgar( $entry, '1.3' ) == 'Rocketgenius' || rgar( $entry, '1.6' ) == 'Rocketgenius') {
$entry['2'] = '[email protected]';
}
return $entry;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 2.3.4.2.
Source Code
This filter is located in GFFormDisplay::handle_submission() in form_display.php.

gform_entry_list_columns

gform_entry_list_columns

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
The 「gform_entry_list_columns」 filter in Gravity Forms allows the columns set to be displayed on the Entry List page to be changed. This allows different columns to be displayed for each form.
Usage
The following would apply to all forms:
add_filter( 'gform_entry_list_columns', 'your_function_name', 10, 2 );

To target a specific form, append the form id to the hook name. (format: gform_entry_list_columns_FORMID)
add_filter( 'gform_entry_list_columns_1', 'your_function_name', 10, 2 );

Parameters

$table_columns array
The columns to be displayed in the entry list table.

$form_id integer
The ID of the form to which the entries being displayed belong.

Examples
This example adds the Address City column on the form to be displayed in the entry list.
add_filter( 'gform_entry_list_columns', 'set_columns', 10, 2 );
function set_columns( $table_columns, $form_id ){
$table_columns['field_id-3.3'] = 'City';
return $table_columns;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 2.0.7.6.
Source Code
This filter is located in GF_Entry_List_Table::get_columns() in entry_list.php.

gform_entry_created

gform_entry_created

DescriptionUsageParametersExamples1. Add a value to the entry meta.2. Delete an entry propertySource Code

Description
This hook fires after the lead has been created but before the post has been created, notifications have been sent, and the confirmation has been processed.
Usage
1add_action( 'gform_entry_created', 'your_function_name', 10, 2 );

Parameters

$entry Entry Object
The entry that was just created.

$form Form Object
The current form.

Examples
1. Add a value to the entry meta.
This example demonstrates how to use to the gform_entry_created hook to populate a value in the entry』s entry meta. It is possible to populate the entry meta anywhere you have the entry ID; however, let』s assume that we』re going to retrieve this entry meta and replace a gform_custom_merge_tags.
123456789101112131415add_action( 'gform_entry_created', 'generate_mergedoc' );function generate_mergedoc( $entry, $form ) {     $feed = self::get_mergedoc_feeds( $form['id'] );     if ( empty( $feed ) || ! rgar( $feed, 'active' ) || ! $entry )        return;     // get download link    $download_link = self::get_download_link( $uid );     // update entry meta    gform_update_meta( $entry['id'], 'gfmergedoc_download_link', $download_link ); }
2. Delete an entry property
The following example shows how you can delete an entry property such as the user agent from the database.
123add_action( 'gform_entry_created', function( $entry ) {    GFAPI::update_entry_property( $entry['id'], 'user_agent', '' );} );
Source Code
This filter is located in GFFormDisplay::handle_submission() in form_display.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_entries_column

gform_entries_column

DescriptionUsageParametersExamplesSource Code

Description
Use this action to inject markup to any non-first column of every entry in the entry list grid.
Usage
add_action( 'gform_entries_column', 'add_icon', 10, 5 );

Parameters

$form_id integer
ID of the current form.

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

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

$entry Entry Object
Current entry object.

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

Examples
This example appends an icon to the column depending on the text being displayed in the cell.
Note: This example assumes that field with ID 5 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_action( 'gform_entries_column', 'add_icon', 10, 5 );
function add_icon( $form_id, $field_id, $value, $entry, $query_string ) {

//targeting form 190 only.
if ( $form_id != 190 )
return;

//targeting field 5 only
if ( $field_id != 5 )
return;

if ( $value == 'yes' ) {
echo " ";
} elseif ( $value == 'no' ) {
echo " ";
}
}

Source Code
This action hook is located in GFEntryList::leads_page() in entry_list.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_entry_detail_sidebar_middle

gform_entry_detail_sidebar_middle

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra content to the sidebar. In Gravity Forms 1.9 and earlier, the content would be displayed before the Notifications box (if visible). In Gravity Forms 2.0+, the content is displayed after the meta boxes but before the print button.
Note: To add custom meta boxes to the sidebar, we recommend using the gform_entry_detail_meta_boxes filter.
Usage
add_action( 'gform_entry_detail_sidebar_middle', 'add_sidebar_text_middle', 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_middle', 'add_sidebar_text_middle', 10, 2 );
function add_sidebar_text_middle( $form, $entry ) {
echo "

Stuff in the Middle

text added in the middle!

";
}

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_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_entry_detail_content_after

gform_entry_detail_content_after

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra text/sections after the main content on the Entry detail page.
Usage
1add_action( 'gform_entry_detail_content_after', 'add_main_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 section with a header and text.
1234add_action( 'gform_entry_detail_content_after', 'add_main_text_after', 10, 2 );function add_main_text_after( $form, $entry ) {    echo '

Main Content After
some stuff

';}
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_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.