-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix wp 6.4/6.3 compat for navigation link variations #59126
Fix wp 6.4/6.3 compat for navigation link variations #59126
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -11,7 +11,7 @@ function gutenberg_navigation_link_variations_compat( $args ) { | |||
if ( 'core/navigation-link' !== $args['name'] || ! empty( $args['variation_callback'] ) ) { | |||
return $args; | |||
} | |||
$args['variation_callback'] = 'build_navigation_link_block_variations'; | |||
$args['variation_callback'] = 'gutenberg_block_core_navigation_link_build_variations'; |
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.
Should there really be the gutenberg_
prefix here? I only see a function called block_core_navigation_link_build_variations
, without the prefix. Here:
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.
It's my understading that the code in the lib/compat folder only gets loaded if the gutenberg plugin is active on a wordpress installtion with version 6.4/6.3. But the code is not merged into core. And the gutenber plugin prefixes all functions in the block-library with 'gutenberg_' on build process, to avoid a clash with existinf core functions.
In my local testing with wp 6.4 this works and the function is called -> the variations for core post types and post types registeres before init#10 are created.
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.
You're right, I didn't know this 🙂
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.
👍
Co-authored-by: gaambo <gaambo@git.wordpress.org>
I just cherry-picked this PR to the cherry-pick-beta-2 branch to get it included in the next release: 9cf215c |
Co-authored-by: gaambo <gaambo@git.wordpress.org>
Great work here 👏 |
What?
This is a follow up to #58389. It introduced backwards compatibility for the navigation link variations changes for wordpress 6.4/6.3.
As @jsnajdr found out, the function name used for the variation_callback was wrong (the unprefixed/unbuilt version). And therefore lead to e2e tests expecting the "Page Link" variation to exist failing.
Why?
How?
Change function to correct name. Also removed a wrong
@uses
comment missed in the last commit.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast