Description
Use this filter to change the field's value before getting displayed on the Entry list page. Useful when creating custom field types that require special formatting for the entry list
Usage
<?php
add_filter("gform_entries_field_value", "modify_entry_values");
?>
Parameters
- $value
- (string) The current entry value to be filtered.
- $form_id
- (integer) The ID of the form from which the entry value was submitted.
- $field_id
- (integer) The ID of the field from which the entry value was submitted.
- $lead
- (Lead Object) The current lead.
Examples
This example assumes the original value is a comma delimited list of category IDs (ie '1,3,4'). We then break the IDs into an array, loop through each ID to get the category name, and format the category name into an unordered list (example output: [1]).
<?php
add_filter('gform_entries_field_value', 'display_category_names', 10, 3);
function display_category_names($value, $form_id, $field_id) {
if($form_id != 3 || $field_id != 4)
return $value;
$newvalue = '';
$categories = explode(',', $value);
foreach($categories as $category) {
$new_value .= '<li>' . get_cat_name($category) . '</li>';
}
return '<ul>' . $new_value . '</ul>';
}
?>
Additional Notes
This hook is useful for storing entry values in one format, while displaying them on the entries page in another (refer to the example above).
Source Code
This filter is located in entry_list.php