-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation block: Remove more obsolete Block Hooks helpers #67193
Merged
ockham
merged 2 commits into
trunk
from
remove/more-navigation-block-block-hooks-helpers
Nov 27, 2024
+2
−29
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1436,20 +1436,6 @@ function block_core_navigation_get_most_recently_published_navigation() { | |
return null; | ||
} | ||
|
||
/** | ||
* Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks. | ||
* | ||
* @since 6.5.0 | ||
* | ||
* @param string $serialized_block The serialized markup of a block and its inner blocks. | ||
* @return string | ||
*/ | ||
function block_core_navigation_remove_serialized_parent_block( $serialized_block ) { | ||
$start = strpos( $serialized_block, '-->' ) + strlen( '-->' ); | ||
$end = strrpos( $serialized_block, '<!--' ); | ||
return substr( $serialized_block, $start, $end - $start ); | ||
} | ||
|
||
/** | ||
* Mock a parsed block for the Navigation block given its inner blocks and the `wp_navigation` post object. | ||
* 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 ) { | |
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) { | ||
$mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post ); | ||
|
||
if ( function_exists( 'apply_block_hooks_to_content' ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$mock_navigation_block_markup = serialize_block( $mock_navigation_block ); | ||
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' ); | ||
} | ||
|
||
$hooked_blocks = get_hooked_blocks(); | ||
$before_block_visitor = null; | ||
$after_block_visitor = null; | ||
|
||
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) { | ||
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' ); | ||
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' ); | ||
} | ||
|
||
return traverse_and_serialize_block( $mock_navigation_block, $before_block_visitor, $after_block_visitor ); | ||
$mock_navigation_block_markup = serialize_block( $mock_navigation_block ); | ||
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' ); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is no longer used anywhere in the codebase (grep to verify).