Skip to content

Commit

Permalink
Block Hooks: Revert opening up hooked blocks to all block themes (#46935
Browse files Browse the repository at this point in the history
)

* 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>
  • Loading branch information
3 people committed Apr 26, 2024
1 parent 86eee17 commit ed430bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: update

Reverts auto-injecting specific Woo Blocks in every block theme and restores only auto-injecting in themes found in the allow list.
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 ed430bd

Please sign in to comment.