Description
Allows users to filter the field types which are available for use in the merge tag drop down.
Usage
gform.addFilter( 'gform_merge_tags_supported_input_types', function( supportedInputTypes, formId, fields, elementId ){
// do something with the information
return supportedInputTypes;
} );
Parameters
- $supportedInputTypes array
The supported input types. - $formId string
The form ID. - $fields array
The form fields. - $elementId string
The ID of the element (optional).
Example
Add a custom field type to the merge tag selector used for calculations. Note: additional code may be needed in evaluating calculation formulas for custom fields.
gform.addFilter( 'gform_merge_tags_supported_input_types', function( supportedInputTypes, formId, fields, elementId ) {
if ( ( elementId !== 'field_calculation_formula' ) ) {
return supportedInputTypes;
}
supportedInputTypes.push( 'myCustomFieldType' );
return supportedInputTypes;
} );
Since
This hook was added in Gravity Forms 2.8.6
Placement
Your code snippet can be placed in an HTML field on your form or in a theme custom JavaScript file.
See also the JavaScript/jQuery section in this article: Where Do I Put This Code?
Source Code
This action hook is located in assets/js/src/admin/components/merge-tags/dropdown.js.