How can I add the current language to extbase redirection?

In my extbase controller action, I want to redirect to another controller / action after the file has been downloaded, so I call

$this->redirect('index', 'Download', null, null, $this->settings['listView']); 

The problem is that the current language setting is lost during the redirect. The method signature allows an array of $arguments in fourth position, but if I put in L there

 $this->redirect('index', 'Download', null, array('L' => $GLOBALS['TSFE']->sys_language_uid), $this->settings['listView']); 

redirection wraps this with an extension parameter parameter such as

 &tx_myext_controller[L]=0 

So my question is: How to add the current language to extbase redirection?

+4
source share
1 answer

Just a quick tip that I often use when I want to avoid the namespace of the $this->redirect method. I use $this->redirectToUri($uri) , where $uri prepared using uriBuilder (which is probably more flexible than regular redirection).

 $this->uriBuilder->reset()->setArguments(array('L' => $GLOBALS['TSFE']->sys_language_uid))->setTargetPageUid($this->settings['listView']); $uri = $this->uriBuilder->uriFor('index', array(), 'Download'); $this->redirectToUri($uri); 
+6
source

Source: https://habr.com/ru/post/1495360/


All Articles