wordpress-develop/tests
Bernie Reiter 75c06d620c Blocks: Introduce filter to allow easy addition of hooked blocks.
Introduce a `hooked_block_types` filter that allows easier conditional addition (or removal) of hooked blocks for a given anchor block and relative position.

{{{#!php
function insert_shopping_cart_hooked_block( $hooked_blocks, $position, $anchor_block, $context ) {
	if ( 'after' === $position && 'core/navigation' === $anchor_block && /** $context is header template part **/ ) {
		$hooked_blocks[] = 'mycommerce/shopping-cart';
	}
	return $hooked_blocks;
}
add_filter( 'hooked_block_types', 'insert_shopping_cart_hooked_block', 10, 4 );
}}}

Props gziolo, nerrad, dmsnell, ndiego.
Fixes #59424.

git-svn-id: https://develop.svn.wordpress.org/trunk@56673 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-25 08:42:45 +00:00
..
e2e Build/Test Tools: Prevent 404 errors in the E2E tests. 2023-07-11 03:39:39 +00:00
gutenberg Block Editor: Update the Gutenberg branch used to launch Gutenberg e2e tests. 2021-06-01 09:21:36 +00:00
performance Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:21:02 +00:00
phpunit Blocks: Introduce filter to allow easy addition of hooked blocks. 2023-09-25 08:42:45 +00:00
qunit Taxonomy: add taxonomy for user pattern categories. 2023-09-21 04:23:12 +00:00
visual-regression Build/Test Tools: Update some NPM dependencies to the latest versions. 2022-04-08 20:05:03 +00:00