gf_has_filters

gf_has_filters

DescriptionUsageParametersReturnsExamplesSinceSource Code

Description
Determines if a callback has been registered for the specified filter.
Usage
1gf_has_filters( array( 'filter_name', $modifier1 ) );
This helper function also has an alias, gf_has_filter, which can be used like so:
1gf_has_filter( array( 'filter_name', $modifier1 ) );

Parameters

$filter array
Array containing the filter tag as well as the possible modifiers.

$function_to_check bool|callable
The optional callback to check for.

Returns
Returns boolean for whether the hook has any callbacks registered or if a specific callback is registered.

Examples
1$result = gf_has_filters( array( 'gform_pre_render', $form_id ) );
1$result = gf_has_filter( array( 'gform_pre_render', $form_id ) );
1$result = gf_has_filters( array( 'gform_disable_view_counter', $form_id ), '__return_true' );
Since
The gf_has_filters and gf_has_filter functions were added in Gravity Forms version 2.4.18.
Source Code
These helper functions are located in gravityforms.php

发表回复

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