I want to add a filter so that when I go to Entries on a specific form it shows me the label for a specific field, instead of the value. For example, I have a field that is -
Select
Value: 1
Label: Yes
I want to show “Yes”
This is the code I am using that adds a filter so that it shows the label instead of the value for Select fields-
add_filter( 'gform_entries_field_value', function ( $value, $form_id, $field_id, $entry ) {
$field = GFAPI::get_field( $form_id, $field_id );
$value_fields = array(
'select'
);
if ( is_numeric( $field_id ) && in_array( $field->get_input_type(), $value_fields ) ) {
$value = $field->get_value_entry_detail( RGFormsModel::get_lead_field_value( $entry, $field ), '', true, 'text' );
}
return $value;
}, 10, 4 );
This works but it does it for all select fields on all forms.
How can I add a conditional so that it only does it for ID: 15 on Form: 1 ?