The gform_entries_primary_column_filter is a Gravity Forms PHP filter that modifies the contents of the first column in the entries list table.
Usage
To use the filter for all forms:
add_filter('gform_entries_primary_column_filter', 'your_function_name', 10, 7);
Parameters
- $column_value (string) – The column value to be filtered. Contains the field value wrapped in a link/a tag.
- $form_id (integer) – The ID of the current form.
- $field_id (integer | string) – The ID of the field or the name of an entry column (i.e. date_created).
- $entry (array) – The Entry object.
- $query_string (string) – The current page’s query string.
- $edit_url (string) – The URL to the entry edit page.
- $value (string) – The value of the field.
More information
See Gravity Forms Docs: gform_entries_primary_column_filter
Examples
Modify the first column value for form ID 56
This example changes the first column value to a “Click to view entry” link for form ID 56.
add_filter('gform_entries_primary_column_filter', function($column_value, $form_id, $field_id, $entry, $query_string, $edit_url, $field_value) { if ($form_id == 56) { $column_value = '<a href="' . $edit_url . '">Click to view entry</a>'; } return $column_value; }, 10, 7);
Display custom text for a specific field ID
This example replaces the first column value with custom text for a specific field ID (3).
add_filter('gform_entries_primary_column_filter', function($column_value, $form_id, $field_id, $entry, $query_string, $edit_url, $field_value) { if ($field_id == 3) { $column_value = 'Custom text for field 3'; } return $column_value; }, 10, 7);
Add a custom CSS class based on the entry value
This example adds a custom CSS class to the first column based on the entry value.
add_filter('gform_entries_primary_column_filter', function($column_value, $form_id, $field_id, $entry, $query_string, $edit_url, $field_value) { $css_class = $field_value > 10 ? 'high-value' : 'low-value'; $column_value = '<a href="' . $edit_url . '" class="' . $css_class . '">' . $column_value . '</a>'; return $column_value; }, 10, 7);
Show different text for specific form IDs
This example shows different text in the first column for specific form IDs.
add_filter('gform_entries_primary_column_filter', function($column_value, $form_id, $field_id, $entry, $query_string, $edit_url, $field_value) { switch ($form_id) { case 1: $column_value = 'Form 1 custom text'; break; case 2: $column_value = 'Form 2 custom text'; break; } return $column_value; }, 10, 7);