AudioBlock.php
2 years ago
ReusableEditBlock.php
2 years ago
ReusableVideoBlock.php
5 years ago
SelfHostedBlock.php
2 years ago
VimeoBlock.php
2 years ago
YouTubeBlock.php
2 years ago
ReusableVideoBlock.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | namespace PrestoPlayer\Blocks; |
| 4 | |
| 5 | use PrestoPlayer\Models\ReusableVideo; |
| 6 | |
| 7 | class ReusableVideoBlock |
| 8 | { |
| 9 | /** |
| 10 | * Block name |
| 11 | * |
| 12 | * @var string |
| 13 | */ |
| 14 | protected $name = 'reusable-display'; |
| 15 | |
| 16 | /** |
| 17 | * Register Block |
| 18 | * |
| 19 | * @return void |
| 20 | */ |
| 21 | public function register() |
| 22 | { |
| 23 | register_block_type( |
| 24 | "presto-player/$this->name", |
| 25 | [ |
| 26 | 'render_callback' => [$this, 'html'], |
| 27 | ] |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Dynamic block output |
| 33 | * |
| 34 | * @param array $attributes |
| 35 | * @param string $content |
| 36 | * @return void |
| 37 | */ |
| 38 | public function html($attributes) |
| 39 | { |
| 40 | $block = new ReusableVideo($attributes['id']); |
| 41 | return $block->renderBlock(); |
| 42 | } |
| 43 | } |
| 44 |