Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_font_weight_class_and_style()public staticWC 1.0

Get class and style for font-weight from attributes.

Метод класса: StyleAttributesUtils{}

Хуков нет.

Возвращает

Массив.

Использование

$result = StyleAttributesUtils::get_font_weight_class_and_style( $attributes );
$attributes(массив) (обязательный)
Block attributes.

Код StyleAttributesUtils::get_font_weight_class_and_style() WC 8.7.0

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;
}