Description
Allows for the inclusion of custom merge tags wherever merge tag drop downs are generated.
Usage
add_filter( 'gform_custom_merge_tags', 'your_function_name', 10, 4 );
Parameters
$merge_tags
array
The custom merge tags.$form_id
int
The ID of the current form.$fields
Field Object[]
An array of fields objects.$element_id
string|int
The ID of the input field.
Example
add_filter( 'gform_custom_merge_tags', 'custom_merge_tags', 10, 4 );
function custom_merge_tags( $merge_tags, $form_id, $fields, $element_id ) {
$merge_tags[] = array(
'label' => 'Download Link',
'tag' => '{download_link}',
);
return $merge_tags;
}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 1.6.2.
Source Code
This filter is located in:
GFCommon::get_merge_tags() in common.php
GFCommon::insert_calculation_variables() in common.php