Block.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\MultiFormGoals\MultiFormGoal; |
| 4 | |
| 5 | use Give\MultiFormGoals\MultiFormGoal\Model as MultiFormGoal; |
| 6 | |
| 7 | class Block |
| 8 | { |
| 9 | |
| 10 | /** |
| 11 | * Registers Multi-Form Goal block |
| 12 | * |
| 13 | * @since 2.9.0 |
| 14 | **/ |
| 15 | public function addBlock() |
| 16 | { |
| 17 | register_block_type( |
| 18 | 'give/multi-form-goal', |
| 19 | [ |
| 20 | 'render_callback' => [$this, 'renderCallback'], |
| 21 | ] |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Returns Progress Bar block markup |
| 27 | * |
| 28 | * @since 2.9.0 |
| 29 | **/ |
| 30 | public function renderCallback($attributes, $content) |
| 31 | { |
| 32 | $multiFormGoal = new MultiFormGoal( |
| 33 | [ |
| 34 | 'innerBlocks' => $content, |
| 35 | ] |
| 36 | ); |
| 37 | |
| 38 | return $multiFormGoal->getOutput(); |
| 39 | } |
| 40 | } |
| 41 |