Drupal 7 has most global site and page elements hardwired into templates, and gives no control to users to move them around. The primary and secondary link placements are hardwired to core and contrib themes alike. We should stop special-casing these, so they can be moved around and selectively hidden or replaced as needed.
Additionally, this causes code duplication, prevents efficient caching and causes a confusing site builder experience (
/admin/structure/menu/settings is not exactly discoverable).
- Primary and secondary menus as new regions in the default
page.html.twigand in the default (Bartik) theme.
- The site builder can then put any menu block in the "Primary menu" region and it'll be styled as the primary menu. Similar for the "Secondary menu" region.
- All the special snowflake stuff can be removed:
the obsolete code in
the hacky code in
common.incto associate the cache tags for the primary and secondary menus, necessary because they're rendered in a backward way
the global menu settings (the route, the form, the config schema, the config file) to choose "THE primary menu" and "THE secondary menu".
- The goal: look identical to HEAD, which looks like this:
- With this patch: mission succeeded.
- The primary and secondary menus are converted into blocks, and therefore no longer available as theme settings or as variables in the page template.
- The following API functions are removed:
- The primary and secondary menu settings are removed from
- Two new regions in Bartik: