W3cubDocs

/WordPress

WP_Duotone::is_preset( string $duotone_attr ): bool

Checks if we have a valid duotone preset.

Description

Valid presets are defined in the $global_styles_presets array.

Parameters

$duotone_attrstringrequired
The duotone attribute from a block.

Return

bool True if the duotone preset present and valid.

Source

private static function is_preset( $duotone_attr ) {
	$slug      = self::get_slug_from_attribute( $duotone_attr );
	$filter_id = self::get_filter_id( $slug );

	return array_key_exists( $filter_id, self::get_all_global_styles_presets() );
}

Changelog

Version Description
6.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_duotone/is_preset