PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.2.1
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.2.1
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / packages / blocks / Blocks / CartBlock.php
CartBlock.php
44 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCartBlocks\Blocks;
4
5 /**
6 * Cart block.
7 */
8 abstract class CartBlock extends BaseBlock {
9 /**
10 * Get the cart block style.
11 *
12 * @param array $attributes Array of block attributes.
13 *
14 * @return string
15 */
16 public function getStyle( $attributes ) {
17 $styles = '';
18 if ( ! empty( $attributes['border'] ) ) {
19 $styles .= 'border-bottom:var(--sc-drawer-border);';
20 }
21 if ( ! empty( $attributes['backgroundColor'] ) ) {
22 $styles .= 'background-color:' . esc_attr( $attributes['backgroundColor'] ) . ';';
23 }
24 if ( ! empty( $attributes['textColor'] ) ) {
25 $styles .= 'color:' . esc_attr( $attributes['textColor'] ) . ';';
26 $styles .= '--sc-input-label-color:' . esc_attr( $attributes['textColor'] ) . ';';
27 $styles .= '--sc-line-item-description-color:' . esc_attr( $attributes['textColor'] ) . ';';
28 }
29 if ( ! empty( $attributes['padding']['top'] ) ) {
30 $styles .= 'padding-top:' . esc_attr( $attributes['padding']['top'] ) . ';';
31 }
32 if ( ! empty( $attributes['padding']['bottom'] ) ) {
33 $styles .= 'padding-bottom:' . esc_attr( $attributes['padding']['bottom'] ) . ';';
34 }
35 if ( ! empty( $attributes['padding']['left'] ) ) {
36 $styles .= 'padding-left:' . esc_attr( $attributes['padding']['left'] ) . ';';
37 }
38 if ( ! empty( $attributes['padding']['right'] ) ) {
39 $styles .= 'padding-right:' . esc_attr( $attributes['padding']['right'] ) . ';';
40 }
41 return $styles;
42 }
43 }
44