Enqueue preset assets for the page.
Description
Includes a CSS custom property, SVG filter, and block CSS declaration.
Parameters
$filter_id
stringrequired- The filter ID. e.g.
'wp-duotone-blue-orange'
. $duotone_selector
stringrequired- The block’s duotone selector. e.g. ‘.wp-block-image img’.
$filter_value
stringrequired- The filter CSS value. e.g.
'url(#wp-duotone-blue-orange)'
or'unset'
.
Source
private static function enqueue_global_styles_preset( $filter_id, $duotone_selector, $filter_value ) {
$global_styles_presets = self::get_all_global_styles_presets();
if ( ! array_key_exists( $filter_id, $global_styles_presets ) ) {
$error_message = sprintf(
/* translators: 1: Duotone filter ID, 2: theme.json */
__( 'The duotone id "%1$s" is not registered in %2$s settings' ),
$filter_id,
'theme.json'
);
_doing_it_wrong( __METHOD__, $error_message, '6.3.0' );
return;
}
self::$used_global_styles_presets[ $filter_id ] = $global_styles_presets[ $filter_id ];
self::enqueue_custom_filter( $filter_id, $duotone_selector, $filter_value, $global_styles_presets[ $filter_id ] );
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.