block.php
38 lines
| 1 | <?php |
| 2 | /** |
| 3 | * PHP render form Multichoice Block. |
| 4 | * |
| 5 | * @package SureForms. |
| 6 | */ |
| 7 | |
| 8 | namespace SRFM\Inc\Blocks\Multichoice; |
| 9 | |
| 10 | use SRFM\Inc\Blocks\Base; |
| 11 | use SRFM\Inc\Fields\Multichoice_Markup; |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; // Exit if accessed directly. |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Multichoice Block. |
| 19 | */ |
| 20 | class Block extends Base { |
| 21 | /** |
| 22 | * Render the block |
| 23 | * |
| 24 | * @param array<mixed> $attributes Block attributes. |
| 25 | * |
| 26 | * @return string|bool |
| 27 | */ |
| 28 | public function render( $attributes ) { |
| 29 | if ( ! empty( $attributes ) ) { |
| 30 | $markup_class = new Multichoice_Markup( $attributes ); |
| 31 | ob_start(); |
| 32 | // phpcs:ignore |
| 33 | echo $markup_class->markup(); |
| 34 | } |
| 35 | return ob_get_clean(); |
| 36 | } |
| 37 | } |
| 38 |