This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Disable compatibility layer when the WooCommerce Product Grid Block block and WooCommerce Single Product Block are used #8538
Merged
gigitux
merged 14 commits into
add/compatibility-single-product-block
from
8505-the-woocommerce-product-grid-block-block-is-not-visible-on-the-front-end-when-the-products-block-is-on-the-same-page
Feb 28, 2023
+26
−17
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5d9a1bf
Merge branch 'add/compatibility-single-product-block' into 8505-the-w…
gigitux e6e4cab
disable compatibility layer via hook
gigitux f417ee8
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux 84783d9
update docs
gigitux 2963db6
generate the docs
gigitux 386616f
Merge branch 'add/compatibility-single-product-block' of https://gith…
gigitux 1d71030
Merge branch 'add/compatibility-single-product-block' of https://gith…
gigitux c3a9112
Merge branch 'add/compatibility-single-product-block' of https://gith…
gigitux d5b5eef
fix version
gigitux cd46956
Merge branch 'add/compatibility-single-product-block' of https://gith…
gigitux 3d2a4be
fix import
gigitux e77431c
Merge branch 'add/compatibility-single-product-block' of https://gith…
gigitux 18ba63b
fix code after merge
gigitux b24e845
Merge branch 'add/compatibility-single-product-block' into 8505-the-w…
gigitux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -28,7 +28,29 @@ public function init() { | |||||
$this->set_hook_data(); | ||||||
|
||||||
add_filter( 'render_block_data', array( $this, 'update_render_block_data' ), 10, 3 ); | ||||||
add_filter( 'render_block', array( $this, 'inject_hooks' ), 10, 2 ); | ||||||
add_filter( | ||||||
'render_block', | ||||||
function ( $block_content, $block ) { | ||||||
/** | ||||||
* Filters to disable the compatibility layer for the blockified templates. | ||||||
* | ||||||
* This hooks allows to disable the compatibility layer for the blockified. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* | ||||||
* @since TBD | ||||||
* @param boolean. | ||||||
*/ | ||||||
$is_disabled_compatility_layer = apply_filters( 'woocommerce_disable_compatibility_layer', false ); | ||||||
|
||||||
if ( $is_disabled_compatility_layer ) { | ||||||
return $block_content; | ||||||
} | ||||||
|
||||||
$this->inject_hooks( $block_content, $block ); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this value be returned as well?
Suggested change
|
||||||
}, | ||||||
10, | ||||||
2 | ||||||
); | ||||||
|
||||||
} | ||||||
|
||||||
/** | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this
if
clause is the same here and in line 339-342. I wonder if it would make sense to move it before their parent if clauses, in line 328, so we avoid repeating it.