Problem/Motivation
The canonical, edit-form, and delete-form link templates on OgMenuInstance use /admin/ogmenu_instance/..., while the matching routes in og_menu.routing.yml use /admin/structure/ogmenu_instance/.... The add-link template is already correct.
This does not currently break routing because the entity has no route provider and toUrl() resolves the existing route names. However, the mismatch would create conflicting routes if a DefaultHtmlRouteProvider is added, such as when adding the collection route from #2992044: Add a list builder for OG Menu instances and replace the custom OverviewMenuInstances form. A similar inconsistency was fixed for the ogmenu config entity in #2994891: OgMenu collection link template is a 404.
Proposed resolution
Also align the OgMenu config entity link templates with its routes under /admin/structure/menu/ogmenu: fix the overview-form, edit-form, and delete-form paths; add the missing add-form template; and remove canonical, which has no corresponding route. Core config bundle entities such as Menu and NodeType likewise do not define a canonical link template, and toUrl() falls back to edit-form.
Remaining tasks
- Add a kernel test confirming that every link template on both entity types matches the path of its corresponding route.
Issue fork og_menu-3624499
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
joelpittetPushed a follow-up to the MR extending the fix to the
OgMenuconfig entity, which had the same mismatch: link templates under/admin/structure/ogmenu/...while its routes live under/admin/structure/menu/ogmenu/....The change also adds the missing
add-formtemplate and removescanonical, which had no corresponding route and could cause aRouteNotFoundExceptionif anything calledtoUrl('canonical'). Core'sMenuandNodeTypeconfig entities do not define one either.The kernel test is now
OgMenuLinkTemplateTest, with a data provider covering both entity types. I also updated the issue summary to reflect the expanded scope.Note for #2992044: Add a list builder for OG Menu instances and replace the custom OverviewMenuInstances form: !31 adds a
collectiontemplate on the same lines ofOgMenuInstance.php, so whichever lands second will need a trivial rebase. The new test will validate that template automatically.Comment #4
joelpittetComment #6
joelpittetThis feels safe to commit