Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_text_transform_class_and_style()public staticWC 1.0

Get class and style for text-transform from attributes.

Method of the class: StyleAttributesUtils{}

No Hooks.

Return

Array.

Usage

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

StyleAttributesUtils::get_text_transform_class_and_style() code WC 9.4.2

public static function get_text_transform_class_and_style( $attributes ) {

	$custom_text_transform = $attributes['style']['typography']['textTransform'] ?? '';

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