-
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 variations reference issue - Trac 60309 #58072
Conversation
@@ -338,7 +338,7 @@ function block_core_navigation_link_register_variation( $variation ) { | |||
return; | |||
} | |||
|
|||
$navigation_block_type->variations[] = $variation; | |||
$navigation_block_type->variations = array_merge( $navigation_block_type->variations, $variation ); |
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 will not fixed the issue as
gutenberg/packages/block-library/src/navigation-link/index.php
Lines 360 to 363 in 2bc59bd
if ( $variation['name'] === $name ) { | |
unset( $navigation_block_type->variations[ $i ] ); | |
break; | |
} |
I think we can also revert changes introduced in #56100. The hook registration order is not important now that variations are lazily evaluated. |
@kt-12 Idea. We add new function for adding / removing variants. |
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.
The PHPUnit failures have been fixed via #58090 (which is the same approach being suggested here).
If we're going to address directly modifying registered variations as a valid back-compat concern, those PHPUnit tests should be added to the core tests suite that covers the main API for the block type registry, rather than only having tests in this repo for that behavior.
What?
Fixes
WordPress/wordpress-develop#5718 (comment)
Detailed issue in the description - https://core.trac.wordpress.org/ticket/60309#ticket
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast