Problem/Motivation
A view-mode tab only lives under the entity's system path. With /node/1 aliased as /my-pub and a tab with the slug reviews, the tab is at /node/1/reviews: /my-pub/reviews is a 404, every link to the tab shows the system path, and a decoupled frontend that asks Decoupled Router to translate /my-pub/reviews gets nothing back.
Proposed resolution
- A per-tab option, Resolve under the entity's path alias (
alias_subpath, off by default), offered on view-mode tabs only. Form-mode tabs are admin URLs and keep their system path. A post-update stores FALSE on existing tabs. - One inbound/outbound path processor that derives the sub-path instead of storing aliases for it:
- inbound, after core's alias processor:
/my-pub/reviewsbecomes/node/1/reviewswhenreviewsis the slug of an enabled tab and/my-pubis the alias of a canonical path of one of that tab's entity types; - outbound, after core's alias processor: the tab route of an aliased entity becomes
/my-pub/reviews.
A real alias such as
/news/reviewson another entity still wins, and with no tab using the option the processor returns before any lookup, so sites that never tick the box see no change. - inbound, after core's alias processor:
- Decoupled Router:
hook_decoupled_router_info_alter()adds anentity_route_tabkey (id, slug, mode type, mode name) when the translated path is a tab, so a frontend renders the view mode instead of the canonical page. - A public service with the rule (split the slug off a path, check that a system path accepts it) for sites that resolve aliases through their own lookup.
Remaining tasks
- Implement, with kernel tests: both directions, alias ordering, an alias change, a language prefix, Decoupled Router.
- Follow-up: redirect
/old-alias/reviewsafter an alias is renamed (core's auto-redirect only covers/old-alias).
User interface changes
The tab form gets a "View-mode options" section with one checkbox.
API changes
EntityRouteTabInterface::usesAliasSubpath(); the service content_entity_routes.alias_subpath; Decoupled Router responses for tab paths gain entity_route_tab.
Data model changes
A new boolean alias_subpath on entity_route_tab config entities.
Comments
Comment #3
kmajzlik commented