Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_font_family_class_and_style()public staticWC 1.0

Get class and style for font-family from attributes.

Method of the class: StyleAttributesUtils{}

No Hooks.

Return

Array.

Usage

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

StyleAttributesUtils::get_font_family_class_and_style() code WC 9.4.2

public static function get_font_family_class_and_style( $attributes ) {

	$font_family = $attributes['fontFamily'] ?? '';

	if ( $font_family ) {
		return array(
			'class' => sprintf( 'has-%s-font-family', $font_family ),
			'style' => null,
		);
	}
	return self::EMPTY_STYLE;
}