mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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
|
||
|---|---|---|
| .. | ||
| e2e | ||
| gutenberg | ||
| performance | ||
| phpunit | ||
| qunit | ||
| visual-regression | ||