Problem/Motivation
In #3054850 we removed the sorting by weight, which, although correct, still left the order of the configured negotiators not work correctly.
When this module is calling
$this->languageNegotiator->getNegotiationMethods(LanguageInterface::TYPE_INTERFACE);
The plugins are returned in an unexpected order. The reason is that LanguageNegotiator::getNegotiationMethods() first gets all the plugin definitions (unsorted) and then runs an array_intersect_key with the the ones configured and ordered in the UI. So the order in the UI is no longer kept (the plugin definition order wins). It may work elsewhere for core, but in the case of this module, which loops through these and exits if it encounters the selection page plugin first, other negotiation methods which are configured in the UI to come BEFORE it no longer have a chance.
Steps to reproduce
Add a language negotiation method that gets loaded AFTER the language selection page when calling getDefinitions() on the negotiator plugin manager.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3212711-2.patch | 5.88 KB | upchuk |
| #2 | 3212711-2-test-only.patch | 4.75 KB | upchuk |
Issue fork language_selection_page-3212711
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
upchuk commentedHere is a patch that fixes it. Also attaching a test-only patch to prove the problem.
Comment #3
upchuk commentedComment #4
polHi Danny,
Do you think it would be possible to submit a PR on Gitlab ?
Thank you very much!
Comment #6
upchuk commentedPol,
Done, I think.
Comment #7
upchuk commentedNot seeing anywhere the tests running? Did i do this right?
Comment #8
upchuk commented@Pol, thanks, pushed.
Comment #10
pol