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.
Problem/Motivation
When using the "Language from the URL" language detection, the "is-active" CSS class is not added to the li tag of the active language in the language switcher block when the request contains query parameters (for instance from a pager).
Proposed resolution
Add the query parameters to the language switcher links returned by LanguageNegotiationUrl::getLanguageSwitchLinks().
Remaining tasks
Review and probably write a test.
Comment | File | Size | Author |
---|---|---|---|
#23 | 2689607-23.patch | 1.92 KB | morenstrat |
Comments
Comment #2
morenstratComment #4
Ante890 CreditAttribution: Ante890 commentedThank you for the patch . Should be implemented in core.
Comment #5
morenstratUpdated Patch for 8.1.x-dev
Comment #6
Ante890 CreditAttribution: Ante890 commentedComment #8
Ante890 CreditAttribution: Ante890 commentedComment #9
alexpottLet's test this.
Let's not do conversion to short syntax in this issue.
Comment #11
Ante890 CreditAttribution: Ante890 commentedNew patch
Comment #12
Ante890 CreditAttribution: Ante890 commentedComment #13
Ante890 CreditAttribution: Ante890 commentedComment #14
alexpottStill needs an automated test.
Comment #15
Ante890 CreditAttribution: Ante890 commentedI added a query string to doTestLanguageBlockAnonymous test function. Any feedback is welcome.
Comment #16
Ante890 CreditAttribution: Ante890 commentedComment #17
Ante890 CreditAttribution: Ante890 commentedComment #18
amit.drupal CreditAttribution: amit.drupal as a volunteer and at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedReview patch #15 its looking good.it is nicely working
Comment #19
alexpottI think we can just do
$query = $request->query->all();
instead of this.Need a space between , and $options - but I would just do this like this:
$this->drupalGet('', ['query' => ['foo' => 'bar']]);
Also I would detail what the testing purpose is - ie. to ensure that the active class is added correctly if query params are present.
Comment #20
morenstratTest-only patch. This should fail.
Comment #21
morenstratComment #23
morenstratAn the complete patch with fix and test.
Comment #24
Ante890 CreditAttribution: Ante890 commentedGreat work morenstrat. Now I think we have a patch that should be approved.
Comment #25
Ante890 CreditAttribution: Ante890 commentedComment #28
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!