Block.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCartBlocks\Blocks\CollapsibleRow; |
| 4 | |
| 5 | use SureCart\Models\Form; |
| 6 | use SureCartBlocks\Blocks\BaseBlock; |
| 7 | |
| 8 | /** |
| 9 | * Checkout block |
| 10 | */ |
| 11 | class Block extends BaseBlock { |
| 12 | /** |
| 13 | * Render the block |
| 14 | * |
| 15 | * @param array $attributes Block attributes. |
| 16 | * @param string $content Post content. |
| 17 | * |
| 18 | * @return string |
| 19 | */ |
| 20 | public function render( $attributes, $content ) { |
| 21 | ob_start(); |
| 22 | ?> |
| 23 | |
| 24 | <div class="wp-block-surecart-collapsible-row"> |
| 25 | <sc-toggle class="sc-collapsible-row" borderless> |
| 26 | <span slot="summary"> |
| 27 | <?php if ( ! empty( $attributes['icon'] ) ) : ?> |
| 28 | <sc-icon name="<?php echo esc_attr( $attributes['icon'] ); ?>" style="font-size: 18px"></sc-icon> |
| 29 | <?php endif; ?> |
| 30 | <span><?php echo wp_kses_post( $attributes['heading'] ?? '' ); ?></span> |
| 31 | </span> |
| 32 | <?php echo filter_block_content( $content, 'post' ); ?> |
| 33 | </sc-toggle> |
| 34 | </div> |
| 35 | |
| 36 | <?php |
| 37 | return ob_get_clean(); |
| 38 | } |
| 39 | } |
| 40 |