Blocks: Remove `inject_hooked_block_markup` filter.

Per discussion in #59424, there's agreement that the new `hooked_block_types` filter  (introduced in [56673]) covers conditional addition and removal of hooked blocks better and at a higher level than the `inject_hooked_block_markup` filter that was originally added in [56649] for that same purpose.
Consequently, this changeset removes the latter filter.

Props gziolo.
Fixes #59439.
Built from https://develop.svn.wordpress.org/trunk@56674


git-svn-id: http://core.svn.wordpress.org/trunk@56186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Bernhard Reiter 2023-09-25 09:14:17 +00:00
parent ffb8b43072
commit 9fd898a7c7
2 changed files with 5 additions and 24 deletions

View File

@ -818,9 +818,7 @@ function make_before_block_visitor( $context ) {
*/ */
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context ); $hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
foreach ( $hooked_block_types as $hooked_block_type ) { foreach ( $hooked_block_types as $hooked_block_type ) {
$hooked_block_markup = get_comment_delimited_block_content( $hooked_block_type, array(), '' ); $markup .= get_comment_delimited_block_content( $hooked_block_type, array(), '' );
/** This filter is documented in wp-includes/blocks.php */
$markup .= apply_filters( 'inject_hooked_block_markup', $hooked_block_markup, $hooked_block_type, $relative_position, $parent, $context );
} }
} }
@ -830,20 +828,7 @@ function make_before_block_visitor( $context ) {
/** This filter is documented in wp-includes/blocks.php */ /** This filter is documented in wp-includes/blocks.php */
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context ); $hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
foreach ( $hooked_block_types as $hooked_block_type ) { foreach ( $hooked_block_types as $hooked_block_type ) {
$hooked_block_markup = get_comment_delimited_block_content( $hooked_block_type, array(), '' ); $markup .= get_comment_delimited_block_content( $hooked_block_type, array(), '' );
/**
* Filters the serialized markup of a hooked block.
*
* @since 6.4.0
*
* @param string $hooked_block_markup The serialized markup of the hooked block.
* @param string $hooked_block_type The type of the hooked block.
* @param string $relative_position The relative position of the hooked block.
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
* @param array $block The anchor block.
* @param WP_Block_Template|array $context The block template, template part, or pattern that the anchor block belongs to.
*/
$markup .= apply_filters( 'inject_hooked_block_markup', $hooked_block_markup, $hooked_block_type, $relative_position, $block, $context );
} }
return $markup; return $markup;
@ -885,9 +870,7 @@ function make_after_block_visitor( $context ) {
/** This filter is documented in wp-includes/blocks.php */ /** This filter is documented in wp-includes/blocks.php */
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context ); $hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
foreach ( $hooked_block_types as $hooked_block_type ) { foreach ( $hooked_block_types as $hooked_block_type ) {
$hooked_block_markup = get_comment_delimited_block_content( $hooked_block_type, array(), '' ); $markup .= get_comment_delimited_block_content( $hooked_block_type, array(), '' );
/** This filter is documented in wp-includes/blocks.php */
$markup .= apply_filters( 'inject_hooked_block_markup', $hooked_block_markup, $hooked_block_type, $relative_position, $block, $context );
} }
if ( $parent && ! $next ) { if ( $parent && ! $next ) {
@ -898,9 +881,7 @@ function make_after_block_visitor( $context ) {
/** This filter is documented in wp-includes/blocks.php */ /** This filter is documented in wp-includes/blocks.php */
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context ); $hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
foreach ( $hooked_block_types as $hooked_block_type ) { foreach ( $hooked_block_types as $hooked_block_type ) {
$hooked_block_markup = get_comment_delimited_block_content( $hooked_block_type, array(), '' ); $markup .= get_comment_delimited_block_content( $hooked_block_type, array(), '' );
/** This filter is documented in wp-includes/blocks.php */
$markup .= apply_filters( 'inject_hooked_block_markup', $hooked_block_markup, $hooked_block_type, $relative_position, $parent, $context );
} }
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.4-alpha-56673'; $wp_version = '6.4-alpha-56674';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.