Skip to content

Commit

Permalink
Cherry pick 46935 into release/8.9 (#47081)
Browse files Browse the repository at this point in the history
* Block Hooks: Revert opening up hooked blocks to all block themes (#46935)

* Revert opening up hooked blocks to all block themes.

* Add changefile(s) from automation for the following project(s): woocommerce

* Add version to @SInCE tag in fn comment.

Missing @SInCE version throwing a CI check error:

`A "@SInCE" tag was found but no version declared.`

Adding `8.4.0`, as this was the version referenced before the revert.

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Daniel W. Robert <danielwrobert@gmail.com>

* Prep for cherry pick 46935

---------

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Daniel W. Robert <danielwrobert@gmail.com>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
  • Loading branch information
5 people committed May 1, 2024
1 parent 98438d8 commit ec805f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/woocommerce/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ WooCommerce comes with some sample data you can use to see how products look; im
* Add - Use a public helper API endpoint update-check-public to check latest versions of WooCommerce extensions and show a plugin update message in the plugin table list to connect to woocommerce.com. [#46082](https://github.com/woocommerce/woocommerce/pull/46082)
* Add - Use state names in Checkout Block address cards. [#45799](https://github.com/woocommerce/woocommerce/pull/45799)
* Add - [Product Block Editor]: register `metadata` attribute for all blocks [#45657](https://github.com/woocommerce/woocommerce/pull/45657)
* Update - Reverts auto-injecting specific Woo Blocks in every block theme and restores only auto-injecting in themes found in the allow list. [#46935](https://github.com/woocommerce/woocommerce/pull/46935)
* Update - Add coming soon banner on the frontend when coming soon mode is enabled. [#46096](https://github.com/woocommerce/woocommerce/pull/46096)
* Update - Add feature flag check for patterns and wrap coming soon template and patterns under feature flag [#46856](https://github.com/woocommerce/woocommerce/pull/46856)
* Update - Additional Checkout Fields has been graduated to stable. [#46805](https://github.com/woocommerce/woocommerce/pull/46805)
Expand Down
11 changes: 10 additions & 1 deletion plugins/woocommerce/src/Blocks/Utils/BlockHooksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ public function register_hooked_block( $hooked_blocks, $position, $anchor_block,
$active_theme_name = wp_get_theme()->get( 'Name' );
}

if ( $context ) {
/**
* A list of theme slugs to execute this with. This is a temporary
* measure until improvements to the Block Hooks API allow for exposing
* to all block themes.
*
* @since 8.4.0
*/
$theme_include_list = apply_filters( 'woocommerce_hooked_blocks_theme_include_list', array( 'Twenty Twenty-Four', 'Twenty Twenty-Three', 'Twenty Twenty-Two', 'Tsubaki', 'Zaino', 'Thriving Artist', 'Amulet', 'Tazza' ) );

if ( $context && in_array( $active_theme_name, $theme_include_list, true ) ) {
foreach ( $this->hooked_block_placements as $placement ) {

if ( $placement['position'] === $position && $placement['anchor'] === $anchor_block ) {
Expand Down

0 comments on commit ec805f1

Please sign in to comment.