Open Antikon opened 5 years ago
yes indeed. adding query params should and must be possible. for quick fix: add an url rule, better for seo anyhow :-)
would you like to send a PR?
Sure, but a little bit later
Would be nice. otherwise i will pick the issue but not within next few days. If you need assistance, let me know. The check for exisiting params should be done here i assume:
But we have to compare the get parameters against the current url - as get params will also be resolved when using url rules
I've made some investigations. The LangSwitcher widget itself can add additional params to URL (see line 229). https://github.com/luyadev/luya-module-cms/blob/9ce31a834c05d7b14cb2e54f4b8f0bb544ad70aa/src/widgets/LangSwitcher.php#L214-L231
The URL rule in my case comes from ModuleReflection class https://github.com/luyadev/luya/blob/0860ac787cc5e37aa966446952e0f524ff3d3edd/core/base/ModuleReflection.php#L133-L180
My question is what is 'args' and 'originalArgs' and how they should be populated from parseRequest method (line 156)?
If we use $route = $this->request->resolve() instead, then the 'path' parameter from CatchAllUrlRule will be added also.
Does that help?
One of the typical scenarios on page is to update some model. In this case an URL looks like http://host/lang/module/controller/update?id=5.
Switching the language should keep the same form but change the labels and so on.
At present the widget drops a query string, so the URL becomes http://host/lang2/module/controller/update. It causes Bad Request since the id is missed.
LUYA Core Version: 1.0.20 LUYA CMS Version: 2.1.0