Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_border_color_class_and_style()public staticWC 1.0

Get class and style for border-color from attributes.

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

Хуков нет.

Возвращает

(Массив. | null)

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

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

Код StyleAttributesUtils::get_border_color_class_and_style() WC 6.8.0

public static function get_border_color_class_and_style( $attributes ) {

	$border_color = $attributes['borderColor'] ?? '';

	$custom_border_color = $attributes['style']['border']['color'] ?? '';

	if ( ! $border_color && '' === $custom_border_color ) {
		return null;
	};

	if ( $border_color ) {
		return array(
			'class' => sprintf( 'has-border-color has-%s-border-color', $border_color ),
			'style' => null,
		);
	} elseif ( '' !== $custom_border_color ) {
		return array(
			'class' => null,
			'style' => sprintf( 'border-color: %s;', $custom_border_color ),
		);
	}
	return null;
}