Problem/Motivation
In the current version of the module, the user Navigation block that lives at the bottom of the Navigation bar is a set of custom links defined in \Drupal\navigation\UserLazyBuilder::userOperationLinks
. It is not using the "User account menu" or any other mechanism to allow a site admin to adjust the links presented here. This was brought up as a question as to why we have this approach, by catch in the core MR (#3438895: Add the new Navigation to core as an Experimental module). Link to the specific, relevant comment:
https://git.drupalcode.org/project/drupal/-/merge_requests/7474#note_297387
It appears the current implementation has been carried as is, since early in the development lifecycle and this question hasn't had sufficient scrutiny.
A couple of things would be different if we use the "User account menu". First, we would lose the "Edit profile" link. Second, the default label would be different. We currently have "View profile", core has "My account". Finally, the "User account menu" is often a user-facing menu whereas what navigation is trying to achieve would be different in many ways and may evolve differently from the "User account menu".
Proposed resolution
- Create a new "Navigation user links" menu when installing the module
- By default, use the same set of links in the new menu that are currently hardcoded
- Use the new menu for the User Navigation block (
\Drupal\navigation\Plugin\Block\NavigationUserBlock
- Take care to mitigate any potential caching issues
- Consider a fallback for the "Navigation user links" menu missing
Remaining tasks
Needs a FunctionalJavascript test.
User interface changes
Nothing visible. Only the underlying data structure / sources are changing.
API changes
None.
Data model changes
New "Navigatoin user links" menu is introduced on navigation module installation.