Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_line_height_class_and_style()public staticWC 1.0

Get class and style for line height from attributes.

Method of the class: StyleAttributesUtils{}

No Hooks.

Return

Array.

Usage

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

StyleAttributesUtils::get_line_height_class_and_style() code WC 9.4.2

public static function get_line_height_class_and_style( $attributes ) {

	$line_height = $attributes['style']['typography']['lineHeight'] ?? '';

	if ( ! $line_height ) {
		return self::EMPTY_STYLE;
	}

	return array(
		'class' => null,
		'style' => sprintf( 'line-height: %s;', $line_height ),
	);
}