mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 15:15:55 +02:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user