Changing labels
As well as changing values, a common thing is to change the label for a specific field for the Excel. You can override
the label hooking into gfexcel_field_label
.
The field object is provided as parameter, so you can check for type and stuff programatically.
Filter signature
The complete filter is gfexcel_field_label_{type}_{form_id}_{field_id}
, where you replace the curly-braces parts. The
field object is provided as a parameter, so you can also check thing programmatically.
Example
In this example we change the value for the label, for field 5 in form 3. In all other cases, we leave the label
untouched.
add_filter('gfexcel_field_label', function($label, GF_Field $field) {
if ($field->formId === 3 && $field->id === 5) {
return 'Our custom label';
}
return $label;
}, 10, 2);