Problem/Motivation
The toolbar subtrees use a hash to determine if access to the subtree should be allowed in ToolbarController::checkSubTreeAccess(). In certain situations the hash does not match, resulting in a JavaScript error and the subtrees not dynamically loading.
Steps to reproduce
- Set the admin menu in vertical mode.
- Make sure to have a site with 2 languages.
- Enable the Account administration pages on Language negotiation > Detection and selection
- Set the default language to something non-english
- Set an admin language in your user profile other than the default site language (e.g. english).
- Go to a content page in your content language
- Refresh the cache (I did this from the content page with devel module)
- Navigate to an admin page
- Observe that the toolbar submenu toggles are not shown and there is a JavaScript error
Temporarily commenting out the hash check from ToolbarController::checkSubTreeAccess() makes the toggles appear again.
Proposed resolution
The hash is calculated from the rendered subtrees, but if the rendered content changes (assumably because the labels are suddenly in another language), the hash no longer matches with the sent one and the access check fails.
I am not entirely sure why the hash is even there, so perhaps this can be added in a comment?
Perhaps create a hash from something that is not language/content dependent (before rendering)?
Remaining tasks
TBD
User interface changes
Hopefully none
API changes
Probably none