Problem/Motivation
The static data endpoint answers with three menus, and it finds them by asking for three machine names written into the code: header-menu, header-links-top and footer-menu. The 404 endpoint asks for two more, menu-404 and 404. Those are the names of the menus of one site. Anywhere else the same code answers with empty keys and says nothing about why: the front end is told the site has no header menu, when what actually happened is that its header menu is called something else.
A site's menus are not knowable in advance, and nothing in Drupal says they must be called anything in particular. Asking for a name is the wrong question; the right one is "which menus does this site have".
Proposed resolution
- The response carries the menus the site has, keyed by machine name, rather than three keys named after another site's menus.
- A site that wants a subset, or wants a menu under a key of its own, says so where the rest of its model is said - in the structure that assembles the block, which already takes the name of a menu and its depth as settings.
- Administrative menus are not part of a front end's answer, and the module knows which they are without a list of names: what a site publishes stays the site's decision, but the default is what a reader would expect.
- No menu machine name in the code of this module, in any resource.
- Coverage on a site whose menus are named nothing like the ones above - which is every site except one.
Remaining tasks
Everything.
Issue fork myrest-3623459
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 #4
sergeydruua commentedComment #6
sergeydruua commented