From 35a68e212c904acd8ae5e9969a3f8defc88b9dd8 Mon Sep 17 00:00:00 2001 From: Nathan Silveira Date: Wed, 13 Dec 2023 10:38:33 -0300 Subject: [PATCH] Update template to use new function register_block_type_from_metadata (#42711) --- .../changelog/update-create-prod-editor | 4 ++++ .../plugin-templates/$slug.php.mustache | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 packages/js/create-product-editor-block/changelog/update-create-prod-editor diff --git a/packages/js/create-product-editor-block/changelog/update-create-prod-editor b/packages/js/create-product-editor-block/changelog/update-create-prod-editor new file mode 100644 index 00000000000..081e4b6c61b --- /dev/null +++ b/packages/js/create-product-editor-block/changelog/update-create-prod-editor @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Update template to use new function register_block_type_from_metadata diff --git a/packages/js/create-product-editor-block/plugin-templates/$slug.php.mustache b/packages/js/create-product-editor-block/plugin-templates/$slug.php.mustache index 64030fd7764..fda77502e97 100644 --- a/packages/js/create-product-editor-block/plugin-templates/$slug.php.mustache +++ b/packages/js/create-product-editor-block/plugin-templates/$slug.php.mustache @@ -33,6 +33,8 @@ use Automattic\WooCommerce\Admin\BlockTemplates\BlockTemplateInterface; use Automattic\WooCommerce\Admin\Features\ProductBlockEditor\ProductTemplates\ProductFormTemplateInterface; +use Automattic\WooCommerce\Admin\Features\ProductBlockEditor\BlockRegistry; + /** * Registers the block using the metadata loaded from the `block.json` file. @@ -43,7 +45,7 @@ use Automattic\WooCommerce\Admin\Features\ProductBlockEditor\ProductTemplates\Pr */ function {{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init() { if ( isset( $_GET['page'] ) && $_GET['page'] === 'wc-admin' ) { - register_block_type( __DIR__ . '/build' ); + BlockRegistry::get_instance()->register_block_type_from_metadata( __DIR__ . '/build' ); } } add_action( 'init', '{{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init' );