Skip to content

Commit d9eb6d9

Browse files
ockhamdraganescu
andauthored
Navigation block: Remove more obsolete Block Hooks helpers (#67193)
- `block_core_navigation_remove_serialized_parent_block` was `replaced by remove_serialized_parent_block`. - `apply_block_hooks_to_content` has been part of WP Core since 6.6, so we don't need to check for its existence anymore. Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org>
1 parent c070dd4 commit d9eb6d9

File tree

1 file changed

+2
-29
lines changed
  • packages/block-library/src/navigation

1 file changed

+2
-29
lines changed

packages/block-library/src/navigation/index.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,20 +1436,6 @@ function block_core_navigation_get_most_recently_published_navigation() {
14361436
return null;
14371437
}
14381438

1439-
/**
1440-
* Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks.
1441-
*
1442-
* @since 6.5.0
1443-
*
1444-
* @param string $serialized_block The serialized markup of a block and its inner blocks.
1445-
* @return string
1446-
*/
1447-
function block_core_navigation_remove_serialized_parent_block( $serialized_block ) {
1448-
$start = strpos( $serialized_block, '-->' ) + strlen( '-->' );
1449-
$end = strrpos( $serialized_block, '<!--' );
1450-
return substr( $serialized_block, $start, $end - $start );
1451-
}
1452-
14531439
/**
14541440
* Mock a parsed block for the Navigation block given its inner blocks and the `wp_navigation` post object.
14551441
* The `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is queried to add the `metadata.ignoredHookedBlocks` attribute.
@@ -1504,19 +1490,6 @@ function block_core_navigation_mock_parsed_block( $inner_blocks, $post ) {
15041490
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
15051491
$mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post );
15061492

1507-
if ( function_exists( 'apply_block_hooks_to_content' ) ) {
1508-
$mock_navigation_block_markup = serialize_block( $mock_navigation_block );
1509-
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' );
1510-
}
1511-
1512-
$hooked_blocks = get_hooked_blocks();
1513-
$before_block_visitor = null;
1514-
$after_block_visitor = null;
1515-
1516-
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
1517-
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
1518-
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
1519-
}
1520-
1521-
return traverse_and_serialize_block( $mock_navigation_block, $before_block_visitor, $after_block_visitor );
1493+
$mock_navigation_block_markup = serialize_block( $mock_navigation_block );
1494+
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' );
15221495
}

0 commit comments

Comments
 (0)