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.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注