Automattic\WooCommerce\Blocks\Utils
StyleAttributesUtils::get_border_style_class_and_style
Get class and style for border width from attributes.
Метод класса: StyleAttributesUtils{}
Хуков нет.
Возвращает
Массив.
Использование
$result = StyleAttributesUtils::get_border_style_class_and_style( $attributes );
- $attributes(массив) (обязательный)
- Block attributes.
Код StyleAttributesUtils::get_border_style_class_and_style() StyleAttributesUtils::get border style class and style WC 10.4.3
public static function get_border_style_class_and_style( $attributes ) {
$custom_border = $attributes['style']['border'] ?? '';
if ( '' === $custom_border ) {
return self::EMPTY_STYLE;
}
$style = '';
if ( array_key_exists( 'style', ( $custom_border ) ) && ! empty( $custom_border['style'] ) ) {
$style = 'border-style:' . $custom_border['style'] . ';';
} else {
foreach ( $custom_border as $side => $value ) {
if ( isset( $value['style'] ) ) {
$style .= 'border-' . $side . '-style:' . $value['style'] . ';';
}
}
}
return array(
'class' => null,
'style' => $style,
);
}