Controllers
2 months ago
DataTransferObjects
2 years ago
resources
10 months ago
Block.php
10 months ago
block.json
6 months ago
Block.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\DonationForms\Blocks\DonationFormBlock; |
| 4 | |
| 5 | use Give\DonationForms\Blocks\DonationFormBlock\Controllers\BlockRenderController; |
| 6 | |
| 7 | class Block |
| 8 | { |
| 9 | |
| 10 | /** |
| 11 | * @since 3.0.0 |
| 12 | * |
| 13 | * @return void |
| 14 | */ |
| 15 | public function register() |
| 16 | { |
| 17 | register_block_type( |
| 18 | __DIR__, |
| 19 | [ |
| 20 | 'render_callback' => function ($attributes) { |
| 21 | |
| 22 | $controller = new BlockRenderController(); |
| 23 | if (!$controller->isGutenbergEditor()) { |
| 24 | return $controller->render($attributes); |
| 25 | } |
| 26 | |
| 27 | return null; |
| 28 | } |
| 29 | ] |
| 30 | ); |
| 31 | } |
| 32 | } |
| 33 |