Block.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCartBlocks\Blocks\Cart; |
| 4 | |
| 5 | use SureCartBlocks\Blocks\BaseBlock; |
| 6 | |
| 7 | /** |
| 8 | * Cart CTA Block. |
| 9 | */ |
| 10 | class Block extends BaseBlock { |
| 11 | /** |
| 12 | * Render the block |
| 13 | * |
| 14 | * @param array $attributes Block attributes. |
| 15 | * @param string $content Post content. |
| 16 | * @param object $block Block object. |
| 17 | * |
| 18 | * @return string |
| 19 | */ |
| 20 | public function render( $attributes, $content, $block = null ) { |
| 21 | ob_start(); ?> |
| 22 | |
| 23 | <sc-flex |
| 24 | slot="<?php echo esc_attr( 'cart-' . ( $attributes['slot'] ?? 'header' ) ); ?>" |
| 25 | justify-content="space-between" |
| 26 | align-items="center"> |
| 27 | <sc-text style="--font-size: var(--sc-font-size-x-small); --line-height: var(--sc-line-height-dense); --color: var(--sc-color-gray-700)"> |
| 28 | <?php echo wp_kses_post( $attributes['text'] ?? '' ); ?> |
| 29 | </sc-text> |
| 30 | <sc-button href="#" size="small" type="primary">Try It</sc-button> |
| 31 | </sc-flex> |
| 32 | |
| 33 | <?php |
| 34 | return ob_get_clean(); |
| 35 | } |
| 36 | } |
| 37 |