gform_field_map_choices

gform_field_map_choices

DescriptionUsageParametersExamples1. Add new choicePlacementSource CodeSince

Description
The gform_field_map_choices filter can be used to override the choices available in the field map drop down.
Usage
1add_filter( 'gform_field_map_choices', 'your_function_name', 10, 4 );

Parameters

$fields array
The 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
12345add_filter( 'gform_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 Gravity_FormsGravity_FormsSettingsFieldsGeneric_Map::get_value_choices() in includes/settings/fields/class-generic-map.php.
Since
This filter was added in Gravity Forms 2.5.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注