WP_Duotone::is_preset( string|string[] $duotone_attr )

In this article

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

Checks if we have a valid duotone preset.

Description

Valid presets are defined in the $global_styles_presets array.

Parameters

$duotone_attrstring|string[]required
The duotone attribute from a block.

Source

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

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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