Skip to content
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
merged 2 commits into from
Nov 27, 2024

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Nov 21, 2024

What?

Remove a number of Block Hooks related functions from the Navigation block.

Follow-up to #64676.

Why?

As of WP 6.6, Core has replaced usage of these functions by counterparts of its own:

And per #67117, 6.6 is the minimum required WordPress version for the Gutenberg plugin.

How?

By removing code.

Note

There's a companion PR in wordpress-develop to move these functions into deprecated.php: WordPress/wordpress-develop#7849

Testing Instructions

This should be covered by unit tests (which are run both against the current and previous WP versions).
In addition, you can smoke-test Block Hooks in the Navigation block as described in other related PRs, e.g. #59021.

Copy link

Flaky tests detected in e33647b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11950108503
📝 Reported issues:

@@ -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' ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply_block_hooks_to_content has been part of WP Core since 6.6 -- which is now the minimum requirement for Gutenberg, so it's guaranteed to exist.

* @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 ) {
Copy link
Contributor Author

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).

@ockham ockham marked this pull request as ready for review November 27, 2024 15:52
@ockham ockham requested a review from ajitbohra as a code owner November 27, 2024 15:52
@ockham ockham requested review from a team, glendaviesnz and ramonjd and removed request for a team November 27, 2024 15:52
Copy link

github-actions bot commented Nov 27, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ockham <[email protected]>
Co-authored-by: draganescu <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Contributor

@draganescu draganescu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ockham ockham merged commit d9eb6d9 into trunk Nov 27, 2024
72 checks passed
@ockham ockham deleted the remove/more-navigation-block-block-hooks-helpers branch November 27, 2024 19:35
@github-actions github-actions bot added this to the Gutenberg 19.9 milestone Nov 27, 2024
michalczaplinski pushed a commit that referenced this pull request Dec 5, 2024
- `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 <[email protected]>
Co-authored-by: draganescu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Feature] Block hooks [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants