- Issue created by @djg_tram
- 🇭🇺Hungary djg_tram
First, quick attempt but it seems to work for me now. Could you take a look before I create a MR?
- 🇩🇪Germany simonbaese Berlin
Yes, this could be added to the block configuration.
I also see a
CountryChangeEvent
in your branch. This probably would not make it into the module. The idea is that the current country is set very early during the request (seeCountryEventSubscriber
) and then is immutable. If you have sound reasoning for this, please describe the use case. - 🇭🇺Hungary djg_tram
Yes, I actually added that too because I created it in the meantime but feel free to pick.
My actual use case is to issue a redirect to a specific page when the user changes the country (practically to go to the starting page of that country rather than staying on the same page but with a different country setting. I use a correct middleware redirect approach so it doesn't get executed immediately but gets stored in the kernel and is executed when the current request actually finishes.
But, actually, I can achieve the same effect with using a different Country Switcher, a modified copy of yours that creates the URLs according to my specific needs. And this probably is a cleaner approach, anyway.
- 🇩🇪Germany simonbaese Berlin
The first approach sounds wrong. The
CountryChangeEvent
would fire on every request regardless of the user action. As you mentioned, I think it is better to change the block. You can extend the existing block or maybe even usehook_block_build_BASE_BLOCK_ID_alter
(I haven't tried the hook).Can you please open a "clean" merge request with the changes regarding the International option?
- 🇭🇺Hungary djg_tram
I was hoping for a git revert to function but it doesn't. :-) I'll start all over again.
- 🇭🇺Hungary djg_tram
I hope I didn't screw up, I'm much less familiar with this Drupal Git than with GitHub. :-))