AbstractBlock.php
4 weeks ago
AbstractBlockTemplate.php
2 years ago
Block.php
2 years ago
BlockContainerTrait.php
4 weeks ago
BlockFormattedTemplateTrait.php
2 years ago
BlockTemplate.php
2 years ago
BlockTemplateLogger.php
2 years ago
BlockTemplate.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\WooCommerce\Internal\Admin\BlockTemplates; |
| 4 | |
| 5 | use Automattic\WooCommerce\Admin\BlockTemplates\ContainerInterface; |
| 6 | use Automattic\WooCommerce\Admin\BlockTemplates\BlockInterface; |
| 7 | use Automattic\WooCommerce\Admin\BlockTemplates\BlockTemplateInterface; |
| 8 | |
| 9 | /** |
| 10 | * Block template class. |
| 11 | */ |
| 12 | class BlockTemplate extends AbstractBlockTemplate { |
| 13 | /** |
| 14 | * Get the template ID. |
| 15 | */ |
| 16 | public function get_id(): string { |
| 17 | return 'woocommerce-block-template'; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Add an inner block to this template. |
| 22 | * |
| 23 | * @param array $block_config The block data. |
| 24 | */ |
| 25 | public function add_block( array $block_config ): BlockInterface { |
| 26 | $block = new Block( $block_config, $this->get_root_template(), $this ); |
| 27 | return $this->add_inner_block( $block ); |
| 28 | } |
| 29 | } |
| 30 |