gform_footer_init_scripts_filter

gform_footer_init_scripts_filter

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows the scripts that fire in the footer to be modified.
Note: The gform_init_scripts_footer must be set to true so scripts are initialized in the footer of the site instead of the page body.
Usage
The following would apply to all forms:
add_filter( 'gform_footer_init_scripts_filter', 'your_function_name', 10, 3 );

To target a specific form, append the form id to the hook name. (format: gform_footer_init_scripts_filter_FORMID)
add_filter( 'gform_footer_init_scripts_filter_1', 'your_function_name', 10, 3 );

Parameters

$form_string string
A string of the scripts used in the footer.

$form Form Object
The current form.

$current_page int
The ID of the current page.

Example
add_filter( 'gform_footer_init_scripts_filter', 'filter_footer', 10, 3 );
function filter_footer( $form_string, $form, $current_page ){
$form_string .= "";
return $form_string;
}

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.8.4.
Source Code
This filter is located in GFFormDisplay::footer_init_scripts() in form_display.php.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註