Skip to content

Commit

Permalink
Remove language for ALL urls where it's not needed (outside of pages/…
Browse files Browse the repository at this point in the history
… for now)
  • Loading branch information
rhukster committed Oct 22, 2015
1 parent 6655db6 commit 2f9621a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use Grav\Common\GPM\GPM;
use Grav\Common\Grav;
use Grav\Common\Language\Language;
use Grav\Common\Page\Page;
use Grav\Common\Page\Pages;
use Grav\Common\Plugin;
Expand Down Expand Up @@ -345,8 +346,6 @@ protected function initializeAdmin()
}
}



// Decide admin template and route.
$path = trim(substr($this->uri->route(), strlen($this->base)), '/');
$this->template = 'dashboard';
Expand All @@ -357,6 +356,13 @@ protected function initializeAdmin()
$this->route = array_shift($array);
}

/** @var Language $language */
$require_language = ['pages', 'translations'];
$language = $this->grav['language'];
if ($language->isLanguageInUrl() && !in_array($this->template, $require_language)) {
$this->grav->redirect($this->uri->route());
}

// Initialize admin class.
require_once __DIR__ . '/classes/admin.php';
$this->admin = new Admin($this->grav, $this->base, $this->template, $this->route);
Expand Down

0 comments on commit 2f9621a

Please sign in to comment.