Block.php
37 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 | * Registers Multi-Form Goal block |
| 11 | * |
| 12 | * @since 2.9.0 |
| 13 | **/ |
| 14 | public function addBlock() { |
| 15 | register_block_type( |
| 16 | 'give/multi-form-goal', |
| 17 | [ |
| 18 | 'render_callback' => [ $this, 'renderCallback' ], |
| 19 | ] |
| 20 | ); |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Returns Progress Bar block markup |
| 25 | * |
| 26 | * @since 2.9.0 |
| 27 | **/ |
| 28 | public function renderCallback( $attributes, $content ) { |
| 29 | $multiFormGoal = new MultiFormGoal( |
| 30 | [ |
| 31 | 'innerBlocks' => $content, |
| 32 | ] |
| 33 | ); |
| 34 | return $multiFormGoal->getOutput(); |
| 35 | } |
| 36 | } |
| 37 |