WP_Duotone::enqueue_global_styles_preset( string $filter_id, string $duotone_selector, string $filter_value )

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Enqueue preset assets for the page.

Description

Includes a CSS custom property, SVG filter, and block CSS declaration.

Parameters

$filter_idstringrequired
The filter ID. e.g. 'wp-duotone-blue-orange'.
$duotone_selectorstringrequired
The block’s duotone selector. e.g. ‘.wp-block-image img’.
$filter_valuestringrequired
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

VersionDescription
6.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.