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