Problem/Motivation
The MyAccountMenuLink plugin class is being added to core in #2256521: [META] New plan, Phase 2: Implement menu links as plugins, including static admin links and views, and custom links with menu_link_content entity, all managed via menu_ui module
However, it uses the hidden property to toggle visibility off for anonymous users.
This is not a good idea - hidden should be a strictly static value, not dynamic. This really becomes an issue as we start to implement render caching.
Proposed resolution
re-write this as a link to user.view with dynamic route parameters to affect access since hidden should not be dynamic, but access can be.
The current use of /user has been very problematic in the past. The path 'user' must be accessible for anonymous users, but only visible for authenticated users. Authenticated users should see "My account", but anonymous users should not see it at all.
Remaining tasks
User interface changes
My account link will link directly to user's account (user/$uid), instead of just /user
API changes
N/A
postponed on #2250315: Regression: Bring back node access optimization to menu trees which will add back methods to get the route name and parameters.
Comment | File | Size | Author |
---|---|---|---|
#3 | user_me.patch | 5.86 KB | dawehner |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedThis is important to get done to enable render caching
Comment #2
pwolanin CreditAttribution: pwolanin commented#2305707: MenuLinkContent disabled field should be renamed to enabled and use positive logic may be touching the same code
Comment #3
dawehnerOne idea could be to basically bring me module into core in a really small way. It would allow you to link
to user/me directly and replace it on the incoming request.
Comment #4
znerol CreditAttribution: znerol commented#2294571: Redirect anonymous users to login page from an exception listener instead of in MaintenanceModeSubscriber and restrict access to the my-account link to authenticated users intends to remove
MyAccountMenuLink
completely.Comment #5
dawehnerGreat! Let's drop that issue then.