AddToCartButton
1 year ago
Address
7 months ago
BumpLineItem
4 months ago
Button
7 months ago
BuyButton
1 year ago
Card
7 months ago
Cart
7 months ago
CartBumpLineItem
7 months ago
CartCoupon
7 months ago
CartHeader
7 months ago
CartItems
7 months ago
CartMenuButton
7 months ago
CartMessage
7 months ago
CartSubmit
7 months ago
CartSubtotal
7 months ago
Checkbox
4 months ago
CheckoutErrors
7 months ago
CheckoutForm
4 months ago
CollapsibleRow
1 month ago
CollectionPage
7 months ago
Column
7 months ago
Columns
1 month ago
ConditionalForm
7 months ago
Confirmation
7 months ago
Coupon
4 months ago
CustomerDashboardButton
7 months ago
Dashboard
4 months ago
Divider
7 months ago
Donation
7 months ago
DonationAmount
7 months ago
Email
4 months ago
ExpressPayment
4 months ago
FirstName
4 months ago
Form
2 weeks ago
Heading
7 months ago
Input
7 months ago
InvoiceDetails
7 months ago
InvoiceDueDate
7 months ago
InvoiceMemo
7 months ago
InvoiceNumber
7 months ago
InvoiceReceiptDownload
7 months ago
LastName
4 months ago
LineItemShipping
7 months ago
LineItems
1 month ago
LogoutButton
7 months ago
Name
4 months ago
NameYourPrice
4 months ago
OrderBumps
2 months ago
OrderConfirmationCustomer
7 months ago
OrderConfirmationLineItems
7 months ago
Password
7 months ago
Payment
4 months ago
Phone
1 month ago
PriceChoice
1 month ago
PriceSelector
7 months ago
Product
1 month ago
ProductCollection
1 month ago
ProductCollectionDescription
1 month ago
ProductCollectionImage
1 month ago
ProductCollectionTitle
1 month ago
ProductDonation
1 month ago
ProductDonationAmount
7 months ago
ProductDonationAmounts
7 months ago
ProductDonationCustomAmount
7 months ago
ProductDonationPrices
7 months ago
ProductDonationRecurringPrices
7 months ago
ProductItem
1 month ago
ProductItemImage
1 month ago
ProductItemList
1 month ago
ProductItemPrice
1 month ago
ProductItemTitle
1 month ago
Radio
7 months ago
RadioGroup
7 months ago
SessionDetail
7 months ago
ShippingChoices
7 months ago
StoreLogo
4 months ago
Submit
4 months ago
Subtotal
4 months ago
Switch
7 months ago
TaxIdInput
7 months ago
TaxLineItem
4 months ago
Textarea
4 months ago
Total
4 months ago
Totals
4 months ago
TrialLineItem
4 months ago
Upsell
1 month ago
VariantPriceSelector
1 month ago
BaseBlock.php
3 years ago
BlockService.php
4 years ago
BlockServiceProvider.php
7 months ago
CartBlock.php
2 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:' . 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 |