From cf8b0d5a1a0ce2b0426c512cd8ed7a6938416322 Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:07:40 +0100 Subject: [PATCH] Prevent PHP `doing_it_wrong` warnings in extend-cart-checkout-block package (#52195) --- .../js/extend-cart-checkout-block/$slug.php.mustache | 10 +++++++++- .../fix-enqueue-styles-extend-cart-checkout-block | 4 ++++ packages/js/extend-cart-checkout-block/index.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 packages/js/extend-cart-checkout-block/changelog/fix-enqueue-styles-extend-cart-checkout-block diff --git a/packages/js/extend-cart-checkout-block/$slug.php.mustache b/packages/js/extend-cart-checkout-block/$slug.php.mustache index 1a4c7ba296b..3efbb916321 100644 --- a/packages/js/extend-cart-checkout-block/$slug.php.mustache +++ b/packages/js/extend-cart-checkout-block/$slug.php.mustache @@ -18,9 +18,17 @@ * * @package {{namespace}} */ -add_action( 'woocommerce_blocks_loaded', + +add_action( + 'init', function () { register_block_type_from_metadata( __DIR__ . '/build/js/checkout-newsletter-subscription-block' ); + } +); + +add_action( + 'woocommerce_blocks_loaded', + function () { require_once __DIR__ . '/{{slug}}-blocks-integration.php'; add_action( 'woocommerce_blocks_cart_block_registration', diff --git a/packages/js/extend-cart-checkout-block/changelog/fix-enqueue-styles-extend-cart-checkout-block b/packages/js/extend-cart-checkout-block/changelog/fix-enqueue-styles-extend-cart-checkout-block new file mode 100644 index 00000000000..678a8b6c2da --- /dev/null +++ b/packages/js/extend-cart-checkout-block/changelog/fix-enqueue-styles-extend-cart-checkout-block @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Prevent doing_it_wrong warnings while registering the example block. diff --git a/packages/js/extend-cart-checkout-block/index.js b/packages/js/extend-cart-checkout-block/index.js index 325e7711b22..28f6aa8637e 100644 --- a/packages/js/extend-cart-checkout-block/index.js +++ b/packages/js/extend-cart-checkout-block/index.js @@ -4,7 +4,7 @@ module.exports = { npmDevDependencies: [ '@woocommerce/dependency-extraction-webpack-plugin', '@woocommerce/eslint-plugin', - '@wordpress/prettier-config', + '@wordpress/prettier-config@2.25.13', '@wordpress/scripts', ], },