Description
The gform_addon_field_map_choices filter can be used to override the choices available in the field map drop down.
This filter is deprecated since version 2.5. Use the gform_field_map_choices filter instead.
Usage
Generic: applies to all add-ons and all forms.
add_filter( 'gform_addon_field_map_choices', 'your_function_name', 10, 3 );
Addon-specific: applies to a specific add-on for all forms. Requires a minimum PHP version of 5.3.
add_filter( 'gform_{ADDON_SLUG}_field_map_choices', 'your_function_name', 10, 3 );
See the Gravity Forms Add-On Slugs article for a list of possible slugs.
Parameters
- $fields arrayThe value and label properties for each choice.
- $form_id integer
The ID of the form currently being configured.
- $field_type null | array
Null or the field types to be included in the drop down.
- $exclude_field_types null | array | string
Null or the field type(s) to be excluded from the drop down.
Examples
1. Add new choice to all add-ons
add_filter( 'gform_addon_field_map_choices', function( $fields, $form_id, $field_type, $exclude_field_types ) { $fields[] = array( 'label' => 'The new choice', 'value' => 'new_choice' ); return $fields; }, 10, 4 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFAddOn::get_field_map_choices() in /includes/addon/class-gf-addon.php.
Since
This filter was added in Gravity Forms 2.0.7.11.