Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #0
Problem/Motivation
When using the toolbar 'Back to site' button, the URL returning to is not keeping the original language prefix or the querystring context.
Steps to reproduce:
- Starting from a multilingual site, with an adequate number of nodes published to front page to have a pager represented.
- Navigate to a language prefixed home; from the list of nodes select a page different than first: you end up with a URL like
http://[...]/it/node?page=2
- Select any admin page from the toolbar.
- Click on the 'Back to site' button.
- The URL of the returning to page is
http://[...]/node
, so losing both language context and the actual page of the URL I left to get to the admin pages.
Proposed resolution
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#14 | core-js-ui-autocomplete-2186647-13.patch | 1021 bytes | droplet |
Comments
Comment #1
nod_Borderline critical.
Comment #2
mondrakeProbably, #2146035: drupalSettings.path.pathPrefix does not contain the language identifier is related.
Comment #3
maartendeblock CreditAttribution: maartendeblock commenteddrupalSettings.pathPrefix is indeed empty. But we don't really need it for this functionality. Al we need to know is the basePath and remove it from the current request. This makes it safe for all urls and aliases, with or without pathPrefix or anything else.
I made a patch to fix this.
Comment #4
nod_Since window.location is used in 3 places could you put that in a variable somewhere and use it instead of refering to window.location ?
Also the pathInfo variable is drupalSetting.path, no need to explicitly call that one.
Thanks!
Comment #5
maartendeblock CreditAttribution: maartendeblock commentedLike this?
Comment #6
nod_yep, all good, thanks!
Comment #9
nod_Cancelled patch test, it's only changing JS files.
Comment #10
socketwench CreditAttribution: socketwench commentedPatch applies cleanly, and corrects the issue. Confirmed by manual testing.
Comment #11
nod_This is a reroll because the indentation standard changed for JavaScript files. No need for commit credit because of this reroll.
Comment #12
nod_Comment #13
catchCommitted/pushed to 8.x, thanks!
Comment #14
droplet CreditAttribution: droplet commentedEDIT: Sorry, FILENAME is wrong, but the patch is correct
What if the entry point is a admin page, e.g.: "drupal8x/admin/content"
(Please make sure you don't have escapeAdminPath on your broswer sessionStorage while you do the testing.)
** Also, why doing it from frontend JS ?? Doesn't it should handle by backend toolbar module ?? (that will reduce frontend JS and less reflow.)
Comment #15
nod_Last patch seem wrong though :p
This should have been fixed by #2194763: 'back to site' button doesn't work on site configured for 'dirty' url's.
Comment #16
droplet CreditAttribution: droplet commentedmaybe I should open a new issue for it.
I assumed if you enter "drupal8x/admin/" directly in address bar, it still show "Back to site" link ??
If Yes, my patch still correct.
Comment #17
nod_It's just that the patch has nothing to do with the issue title.
Comment #18
Wim LeersPlease file a new issue rather than reopening only tangentially related existing ones. Thanks!