WP_Duotone::enqueue_global_styles_preset()private staticWP 6.3.0

Enqueue preset assets for the page.

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

Метод класса: WP_Duotone{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WP_Duotone::enqueue_global_styles_preset( $filter_id, $duotone_selector, $filter_value );
$filter_id(строка) (обязательный)
The filter ID. e.g. 'wp-duotone-blue-orange'.
$duotone_selector(строка) (обязательный)
The block's duotone selector. e.g. '.wp-block-image img'.
$filter_value(строка) (обязательный)
The filter CSS value. e.g. 'url(#wp-duotone-blue-orange)' or 'unset'.

Список изменений

С версии 6.3.0 Введена.

Код WP_Duotone::enqueue_global_styles_preset() WP 6.6.2

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 ] );
}