From 94c6807a9604ee3de47d98700ea236239283d626 Mon Sep 17 00:00:00 2001 From: Matt Sherman Date: Thu, 7 Sep 2023 14:40:30 -0400 Subject: [PATCH] Implement woocommerce_block_template_after_add_block action --- .../Admin/BlockTemplates/BlockContainerTrait.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/woocommerce/src/Internal/Admin/BlockTemplates/BlockContainerTrait.php b/plugins/woocommerce/src/Internal/Admin/BlockTemplates/BlockContainerTrait.php index ad2983ada42..11243c847cd 100644 --- a/plugins/woocommerce/src/Internal/Admin/BlockTemplates/BlockContainerTrait.php +++ b/plugins/woocommerce/src/Internal/Admin/BlockTemplates/BlockContainerTrait.php @@ -40,6 +40,19 @@ trait BlockContainerTrait { $root_template = $block->get_root_template(); $root_template->cache_block( $block ); $this->inner_blocks[] = &$block; + + /** + * Action called after a block is added to a block container. + * + * This action can be used to perform actions after a block is added to the block container, + * such as adding a dependent block. + * + * @param BlockInterface $block The block. + * + * @since 8.2.0 + */ + do_action( 'woocommerce_block_template_after_add_block', $block ); + return $block; }