AddToCartButton
2 years ago
Address
3 years ago
BumpLineItem
3 years ago
Button
3 years ago
BuyButton
2 years ago
Card
3 years ago
Cart
3 years ago
CartBumpLineItem
3 years ago
CartCoupon
3 years ago
CartHeader
3 years ago
CartItems
3 years ago
CartMenuButton
3 years ago
CartMessage
3 years ago
CartSubmit
3 years ago
CartSubtotal
3 years ago
Checkbox
3 years ago
CheckoutErrors
3 years ago
CheckoutForm
3 years ago
CollapsibleRow
3 years ago
CollectionPage
2 years ago
Column
2 years ago
Columns
2 years ago
ConditionalForm
3 years ago
Confirmation
3 years ago
Coupon
3 years ago
CustomerDashboardButton
3 years ago
Dashboard
2 years ago
Divider
3 years ago
Donation
3 years ago
DonationAmount
3 years ago
Email
3 years ago
ExpressPayment
3 years ago
FirstName
3 years ago
Form
2 years ago
Heading
3 years ago
Input
3 years ago
LastName
3 years ago
LineItemShipping
3 years ago
LineItems
3 years ago
LogoutButton
3 years ago
Name
3 years ago
NameYourPrice
3 years ago
OrderBumps
2 years ago
OrderConfirmationCustomer
3 years ago
OrderConfirmationLineItems
3 years ago
Password
2 years ago
Payment
2 years ago
Phone
3 years ago
PriceChoice
2 years ago
PriceSelector
2 years ago
Product
2 years ago
ProductCollection
2 years ago
ProductCollectionDescription
2 years ago
ProductCollectionImage
2 years ago
ProductCollectionTitle
2 years ago
ProductItem
2 years ago
ProductItemImage
2 years ago
ProductItemList
2 years ago
ProductItemPrice
2 years ago
ProductItemTitle
2 years ago
Radio
3 years ago
RadioGroup
3 years ago
SessionDetail
3 years ago
ShippingChoices
3 years ago
StoreLogo
3 years ago
Submit
2 years ago
Subtotal
3 years ago
Switch
3 years ago
TaxIdInput
3 years ago
TaxLineItem
3 years ago
Textarea
3 years ago
Total
3 years ago
Totals
2 years ago
BaseBlock.php
3 years ago
BlockService.php
3 years ago
BlockServiceProvider.php
3 years ago
CartBlock.php
3 years ago
CartBlock.php
44 lines
| 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:' . sanitize_hex_color( $attributes['backgroundColor'] ) . ';'; |
| 23 | } |
| 24 | if ( ! empty( $attributes['textColor'] ) ) { |
| 25 | $styles .= 'color:' . sanitize_hex_color( $attributes['textColor'] ) . ';'; |
| 26 | $styles .= '--sc-input-label-color:' . sanitize_hex_color( $attributes['textColor'] ) . ';'; |
| 27 | $styles .= '--sc-line-item-description-color:' . sanitize_hex_color( $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 |