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

Pass some context information to woocommerce_blocks_hook_compatibility_additional_data hook #45156

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: minor
Type: update

Compatibility Layer: pass additional context to woocommerce_blocks_hook_compatibility_additional_data hook which is a class name in which it was called
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ protected function remove_default_hooks() {
remove_action( $hook, $callback, $priority );
}
}
$class_name = basename( str_replace( '\\', '/', get_class( $this ) ) );

/**
* When extensions implement their equivalent blocks of the template
Expand All @@ -161,8 +162,10 @@ protected function remove_default_hooks() {
*
* @since 9.5.0
* @param array $data Additional hooked data. Default to empty
* @param string $class_name Class name within which the hook is called.
* Either ArchiveProductTemplatesCompatibility or SingleProductTemplateCompatibility.
*/
$additional_hook_data = apply_filters( 'woocommerce_blocks_hook_compatibility_additional_data', array() );
$additional_hook_data = apply_filters( 'woocommerce_blocks_hook_compatibility_additional_data', array(), $class_name );

if ( empty( $additional_hook_data ) || ! is_array( $additional_hook_data ) ) {
return;
Expand Down