WP_Duotone::is_presetprivate staticWP 6.3.0

Checks if we have a valid duotone preset.

Valid presets are defined in the $global_styles_presets array.

Method of the class: WP_Duotone{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = WP_Duotone::is_preset( $duotone_attr );
$duotone_attr(string|string[]) (required)
The duotone attribute from a block.

Changelog

Since 6.3.0 Introduced.

WP_Duotone::is_preset() code WP 7.0

private static function is_preset( $duotone_attr ) {
	if ( ! is_string( $duotone_attr ) ) {
		return false;
	}

	$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() );
}