Description
The gform_post_enqueue_scripts action hook is executed at the end of the process of enqueuing scripts and styles for each form embedded in the current page by shortcode or block.
Usage
add_action( 'gform_post_enqueue_scripts', 'your_function_name', 10, 3 );
Parameters
- $found_forms array
An array of found forms using the form ID as the key to the ajax status.
- $found_blocks array
A filtered version of the array returned by parse_blocks containing only Gravity Forms blocks.
- $post WP_Post
The page or post which was processed.
Examples
Basic Usage
add_action( 'gform_post_enqueue_scripts', function ( $found_forms, $found_blocks, $post ) {
foreach ( $found_forms as $form_id => $ajax_status ) {
// Do something for each form.
}
}, 10, 3 );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This hook was added in version 2.4.18.
Source Code
This hook is located in GFFormDisplay::enqueue_scripts() in form_display.php.