Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_shadow_valuepublic staticWC 1.0

Get CSS value for shadow preset. Returns the same value if it's not a preset.

Method of the class: StyleAttributesUtils{}

No Hooks.

Returns

String. CSS value for shadow preset.

Usage

$result = StyleAttributesUtils::get_shadow_value( $shadow_name );
$shadow_name(string) (required)
Shadow name.

StyleAttributesUtils::get_shadow_value() code WC 10.8.1

public static function get_shadow_value( $shadow_name ) {
	if ( is_string( $shadow_name ) && strpos( $shadow_name, 'var:preset|shadow|' ) !== false ) {
		$shadow_name = str_replace( 'var:preset|shadow|', '', $shadow_name );
		return "var(--wp--preset--shadow--{$shadow_name})";
	}

	return $shadow_name;
}