Add a button to switch to a different language version of a page. Uses the switchlanguage task to which I added a redirect parameter to correctly switch the language

This commit is contained in:
Flavio Copes
2015-08-19 14:32:06 +02:00
parent c64432af15
commit c2a54b3770
2 changed files with 19 additions and 2 deletions

View File

@@ -1036,13 +1036,12 @@ class AdminController
protected function taskSwitchlanguage() {
$language = $this->grav['uri']->param('lang');
$redirect = $this->grav['uri']->param('redirect') ? 'pages/' . $this->grav['uri']->param('redirect') : 'pages';
if ($language) {
$this->grav['session']->admin_lang = $language ?: 'en';
}
$redirect = 'pages';
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.SUCCESSFULLY_SWITCHED_LANGUAGE'), 'info');
$this->setRedirect($redirect);