Automattic\WooCommerce\Blocks\Utils
StyleAttributesUtils::get_font_family_class_and_style
Get class and style for font-family from attributes.
Method of the class: StyleAttributesUtils{}
No Hooks.
Returns
Array.
Usage
$result = StyleAttributesUtils::get_font_family_class_and_style( $attributes );
- $attributes(array) (required)
- Block attributes.
StyleAttributesUtils::get_font_family_class_and_style() StyleAttributesUtils::get font family class and style code WC 10.8.1
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;
}