The gform_addon_field_value Gravity Forms PHP filter allows you to modify a value before it’s sent to a third-party by one of the Add-On Framework based add-ons.
Usage
add_filter('gform_addon_field_value', 'your_function_name', 10, 5);
Parameters
- $field_value (string): The value to be modified.
- $form (Form Object): The form currently being processed.
- $entry (Entry Object): The entry currently being processed.
- $field_id (string): The ID of the field currently being processed.
- $slug (string): The add-on slug, including the
gravityformsprefix.
More information
See Gravity Forms Docs: gform_addon_field_value
Examples
Change Value of Specific Field
This example changes the value of field 3 on form 10 before it’s passed to any of the feed add-ons.
add_filter('gform_addon_field_value_10_3', function ($field_value, $form, $entry, $field_id) {
return 'your new value';
}, 10, 4);
Use Choice Text Instead of Value
This example replaces the value of a choice-based survey field with the choice text.
add_filter('gform_addon_field_value', 'gf_get_choice_text', 10, 5);
function gf_get_choice_text($field_value, $form, $entry, $field_id, $slug) {
$field = RGFormsModel::get_field($form, $field_id);
if (is_object($field) && $field->type == 'survey') {
$field_value = $field->get_value_export($entry, $field_id, true);
}
return $field_value;
}
Placement: This code should be placed in the functions.php file of your active theme.