Fix Classic Menu to Navigation Link conversion with entity bindings#72289
Fix Classic Menu to Navigation Link conversion with entity bindings#72289
Conversation
|
Size Change: +13 B (0%) Total Size: 2.18 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in c43a7f2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18465124875
|
c43a7f2 to
148f391
Compare
|
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. |
d3a7ca8 to
a4cb01d
Compare
- Add buildNavigationLinkEntityBinding function to menu-items-to-blocks.js - Update menuItemToBlockAttributes to include entity bindings for non-custom items - Add comprehensive test coverage for entity binding behavior - Ensure classic menu conversions maintain dynamic URL resolution - Follow same pattern as PR #72287 for consistency Fixes classic menu items losing entity relationships during conversion.
a4cb01d to
4992f16
Compare
scruffian
left a comment
There was a problem hiding this comment.
Run the navigation tests ✅
Run all navigation-related tests ✅
Manual import of classic navigation ✅
Code review ✅
| } ), | ||
| ...( object_id && | ||
| 'custom' !== object && { | ||
| ( inferredKind === 'post-type' || inferredKind === 'taxonomy' ) && { |
There was a problem hiding this comment.
Nit: We have similar checks inside buildNavigationLinkEntityBinding. We might want to consider a shared CONST that contains valid kinds.
There was a problem hiding this comment.
Yes I think might be necessary although we do have test coverage protection here.
…72289) * Fix Classic Menu to Navigation Link conversion with entity bindings - Add buildNavigationLinkEntityBinding function to menu-items-to-blocks.js - Update menuItemToBlockAttributes to include entity bindings for non-custom items - Add comprehensive test coverage for entity binding behavior - Ensure classic menu conversions maintain dynamic URL resolution - Follow same pattern as PR #72287 for consistency Fixes classic menu items losing entity relationships during conversion. * Use canonical building of bindings * Update test expectations * Add edge case coverage for unsupported kinds Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org>
|
The automatic backport to the See #72573 for more details. |
What
Fixes the Classic Menu to Navigation Link conversion to automatically create entity bindings for dynamic URLs, ensuring converted links maintain their connection to the underlying page entities. This addresses the issue where Classic Menu items converted to Navigation Links were missing the required entity bindings for dynamic URL resolution.
Why
When a Classic Menu is converted to Navigation blocks, the conversion creates Navigation Link blocks but doesn't add the required entity bindings. This means the links don't have dynamic URLs as per #71630, causing them to lose their connection to the underlying page entities.
How
menuItemToBlockAttributesfunction to automatically includemetadata.bindingswhen converting classic menu items that have entity relationships (object_idexists andobjectis not'custom')Testing Instructions
Automated Testing
Manual Testing with WP-CLI
Note: Run the list commands first to get the actual IDs, then use those IDs in the add commands.
Convert in Site Editor:
Verify Entity Bindings:
metadata.bindings.url.source: 'core/entity'metadata.bindingsTest Dynamic URL Updates:
Expected Results
Screenshots
The conversion process now ensures that classic menu items maintain their entity relationships, providing the same dynamic URL capabilities as the Page List conversion from PR #72287.
Related Issues
This addresses the same underlying issue as PR #72287 but for Classic Menu conversions instead of Page List conversions. Both ensure that Navigation Links maintain dynamic URL resolution through entity bindings.
Notes
object_id && 'custom' !== objectalready existed in the code, making this a natural extension