Skip to content

Commit 937c667

Browse files
committed
Deprecate param in set_ignored_hooked_blocks_metadata
1 parent a0807c6 commit 937c667

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/wp-includes/blocks.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,15 @@ function insert_hooked_blocks( &$parsed_anchor_block, $relative_position, $conte
993993
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
994994
* @param string $relative_position The relative position of the hooked blocks.
995995
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
996+
* @param mixed $deprecated Deprecated. Not used.
996997
* @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to.
997998
* @return string Empty string.
998999
*/
999-
function set_ignored_hooked_blocks_metadata( &$parsed_anchor_block, $relative_position, $context ) {
1000+
function set_ignored_hooked_blocks_metadata( &$parsed_anchor_block, $relative_position, $deprecated = null, $context ) {
1001+
if ( null !== $deprecated ) {
1002+
_deprecated_argument( __FUNCTION__, '6.7.0' );
1003+
}
1004+
10001005
$anchor_block_type = $parsed_anchor_block['blockName'];
10011006
$hooked_block_types = get_hooked_blocks_by_anchor_block( $anchor_block_type, $relative_position, $context );
10021007
if ( empty( $hooked_block_types ) ) {
@@ -1162,7 +1167,7 @@ function update_ignored_hooked_blocks_postmeta( $post ) {
11621167
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
11631168
* @param string $relative_position The relative position of the hooked blocks.
11641169
* Can be one of 'before', 'after', 'first_child', or 'last_child'.
1165-
* @param string $deprecated Deprecated. Not used.
1170+
* @param mixed $deprecated Deprecated. Not used.
11661171
* @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to.
11671172
* @return string
11681173
*/
@@ -1172,7 +1177,7 @@ function insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata( &$parsed_a
11721177
}
11731178

11741179
$markup = insert_hooked_blocks( $parsed_anchor_block, $relative_position, $context );
1175-
$markup .= set_ignored_hooked_blocks_metadata( $parsed_anchor_block, $relative_position, $context );
1180+
$markup .= set_ignored_hooked_blocks_metadata( $parsed_anchor_block, $relative_position, null, $context );
11761181

11771182
return $markup;
11781183
}

tests/phpunit/tests/blocks/setIgnoredHookedBlocksMetadata.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function test_set_ignored_hooked_blocks_metadata() {
6262
)
6363
);
6464

65-
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null );
65+
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null, null );
6666
$this->assertSame( array( 'tests/hooked-block' ), $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] );
6767
}
6868

@@ -90,7 +90,7 @@ public function test_set_ignored_hooked_blocks_metadata_retains_existing_items()
9090
)
9191
);
9292

93-
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null );
93+
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null, null );
9494
$this->assertSame(
9595
array( 'tests/other-ignored-block', 'tests/hooked-block' ),
9696
$anchor_block['attrs']['metadata']['ignoredHookedBlocks']
@@ -117,7 +117,7 @@ public function test_set_ignored_hooked_blocks_metadata_for_block_added_by_filte
117117
};
118118

119119
add_filter( 'hooked_block_types', $filter, 10, 3 );
120-
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null );
120+
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null, null );
121121
remove_filter( 'hooked_block_types', $filter, 10 );
122122

123123
$this->assertSame(
@@ -156,7 +156,7 @@ public function test_set_ignored_hooked_blocks_metadata_for_block_added_by_conte
156156
$template = self::create_block_template_object();
157157

158158
add_filter( 'hooked_block_types', $filter, 10, 4 );
159-
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', $template );
159+
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null, $template );
160160
remove_filter( 'hooked_block_types', $filter, 10 );
161161

162162
$this->assertSame(
@@ -199,7 +199,7 @@ public function test_set_ignored_hooked_blocks_metadata_for_block_suppressed_by_
199199
};
200200

201201
add_filter( 'hooked_block', $filter, 10, 4 );
202-
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null );
202+
set_ignored_hooked_blocks_metadata( $anchor_block, 'after', null, null );
203203
remove_filter( 'hooked_block', $filter );
204204

205205
$this->assertSame( array( 'tests/hooked-block' ), $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] );

0 commit comments

Comments
 (0)