fix(php-transformer): emit a shared navigation entity referenced by token - #2248
Merged
Merged
Conversation
…oken Cluster identical destination lists across template parts and page-owned copies into one menu record, rewrite those core/navigation blocks to a self-closing token ref, and keep overlay and class attributes on the host.
The plan still emits one shared menu entity, but host markup keeps its children so WordPress can render without a destination post id.
This was referenced Sep 26, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Extracted header chrome still inlined
core/navigation-linkchildren. WordPress also ships a default Navigation post with<!-- wp:page-list /-->. Editing the menu in the Site Editor therefore did not change the imported header.Refs #1945.
Design
After shared-shell extraction, cluster
core/navigationblocks that share the same destination list (label + URL, order preserved, including submenus) across template parts and page-owned copies.Each cluster becomes one plan
menusrecord with innerblock_markup, a deterministictoken, andreconciliation_identity. Host blocks become self-closing withrefset to{{wordpress-site-plan:navigation:TOKEN}}, keepingoverlayMenu,className,style, andlayout.No destination post IDs. SSI persists the entity and substitutes the integer
ref.Fix
NavigationEntityProjectionclusters and rewrites parts/pages, then reanchors runtime entity bindings whose byte offsets moved.navigation-linkfilter from entity inner markup.Tests
php tests/contract/shared-navigation-entity.phpfails on trunk (Clustered header destinations become one navigation entity) and passes here.composer test:canonical,composer test:parity(346 fixtures),composer test:packaging, andphp tests/contract/production-acceptance-matrix.phppassed.Evidence
Paired SSI dev package (
blocks-engineSHA527302c608eb) imported the Adventuring Ankara capture.wp_navigationpost titled Header with Home / Blog / About Me / Contact.parts/header.htmland the homepage navigation are<!-- wp:navigation {"ref":N,"overlayMenu":"mobile",...} /-->.1122 / 1183 / 1241 / 1329(unchanged vs baseline).aria-currentmatches baseline on/,/about-me/,/blog/./,/about-me/, and a post.quality_passwith 0 fallbacks.core/navigation, 0 invalid-block warnings.Merge order
fix/1945-shared-navigation-entity(persistwp_navigationand substitute integerref).Do not merge SSI first: older plans have no tokens, and this plan is not yet persisted.
AI assistance
Refs #1945