Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_letter_spacing_class_and_style()public staticWC 1.0

Get class and style for letter-spacing from attributes.

Method of the class: StyleAttributesUtils{}

No Hooks.

Return

Array.

Usage

$result = StyleAttributesUtils::get_letter_spacing_class_and_style( $attributes );
$attributes(array) (required)
Block attributes.

StyleAttributesUtils::get_letter_spacing_class_and_style() code WC 9.4.2

public static function get_letter_spacing_class_and_style( $attributes ) {

	$custom_letter_spacing = $attributes['style']['typography']['letterSpacing'] ?? '';

	if ( '' !== $custom_letter_spacing ) {
		return array(
			'class' => null,
			'style' => sprintf( 'letter-spacing: %s;', $custom_letter_spacing ),
		);
	}
	return self::EMPTY_STYLE;
}