Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Hooks: Revert opening up hooked blocks to all block themes #46935

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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