gform_noconflict_styles

gform_noconflict_styles

DescriptionUsageParametersExamplesPlacementSource Code

Description
When Gravity Forms is running with no-conflict mode enabled, it prevents any unknown styles to be enqueued in the form editor page.
Use this filter to 「register」 your css file with Gravity Forms, making sure it gets enqueued in the form editor page when no-conflict mode is enabled.
Usage
add_filter( 'gform_noconflict_styles', 'register_style' );

Parameters

$styles array
An array of style handles to be filtered. Add styles to this array to register them (i.e. $styles[] = 『my-style-handle』;).

Examples
This example registers a custom style with Gravity Forms:
add_action( 'admin_head', 'enqueue_form_editor_style' );
function enqueue_form_editor_style(){

if ( RGForms::is_gravity_page() ) {
//enqueing my style on gravity form pages
wp_enqueue_style( 'my_style', plugins_url( 'my-style.css', 'my-plugin' ) );
}
}

add_filter( 'gform_noconflict_styles', 'register_style' );
function register_style( $styles ) {

//registering my style with Gravity Forms so that it gets enqueued when running on no-conflict mode
$styles[] = 'my_style';
return $styles;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFForms::no_conflict_mode() in gravityforms.php.

发表回复

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