WP_Duotone::get_global_styles_presets( array $sources ): string

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.

Get the CSS for global styles.

Description

Example output: body{–wp–preset–duotone–blue-orange:url(‘#wp-duotone-blue-orange’);}

Parameters

$sourcesarrayrequired
The duotone presets.

Return

string The CSS for global styles.

Source

private static function get_global_styles_presets( $sources ) {
	$css = 'body{';
	foreach ( $sources as $filter_id => $filter_data ) {
		$slug              = $filter_data['slug'];
		$colors            = $filter_data['colors'];
		$css_property_name = self::get_css_custom_property_name( $slug );
		$declaration_value = is_string( $colors ) ? $colors : self::get_filter_url( $filter_id );
		$css              .= "$css_property_name:$declaration_value;";
	}
	$css .= '}';
	return $css;
}

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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