Add title attribute to custom block to facilitate easier testing
This commit is contained in:
parent
ed0d45178f
commit
44575d6dca
|
@ -18,11 +18,16 @@ class CustomBlock extends AbstractBlock implements CustomBlockInterface {
|
|||
|
||||
/**
|
||||
* Custom method.
|
||||
*
|
||||
* @param string $title The title.
|
||||
*/
|
||||
public function add_custom_inner_block(): BlockInterface {
|
||||
public function add_custom_inner_block( string $title ): BlockInterface {
|
||||
$block = new Block(
|
||||
[
|
||||
'blockName' => 'custom-inner-block',
|
||||
'blockName' => 'custom-inner-block',
|
||||
'attributes' => [
|
||||
'title' => $title,
|
||||
],
|
||||
],
|
||||
$this->get_root_template(),
|
||||
$this
|
||||
|
|
|
@ -8,6 +8,8 @@ use Automattic\WooCommerce\Admin\BlockTemplates\BlockInterface;
|
|||
interface CustomBlockInterface extends BlockContainerInterface {
|
||||
/**
|
||||
* Adds a method to insert a specific custom inner block.
|
||||
*
|
||||
* @param string $title The title.
|
||||
*/
|
||||
public function add_custom_inner_block(): BlockInterface;
|
||||
public function add_custom_inner_block( string $title ): BlockInterface;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue