Automattic\WooCommerce\Blocks\Utils
StyleAttributesUtils::get_font_weight_class_and_style()
Get class and style for font-weight from attributes.
Method of the class: StyleAttributesUtils{}
No Hooks.
Return
Array
.
Usage
$result = StyleAttributesUtils::get_font_weight_class_and_style( $attributes );
- $attributes(array) (required)
- Block attributes.
StyleAttributesUtils::get_font_weight_class_and_style() StyleAttributesUtils::get font weight class and style code WC 9.4.2
public static function get_font_weight_class_and_style( $attributes ) { $custom_font_weight = $attributes['style']['typography']['fontWeight'] ?? ''; if ( '' !== $custom_font_weight ) { return array( 'class' => null, 'style' => sprintf( 'font-weight: %s;', $custom_font_weight ), ); } return self::EMPTY_STYLE; }