set baseRoute with activelang if available

This commit is contained in:
Andy Miller
2020-02-14 08:14:57 -07:00
parent 244c34a536
commit 8ccbcf0488

View File

@@ -95,6 +95,8 @@ class Pages
protected $initialized = false;
protected $active_lang;
/**
* @var Types
*/
@@ -143,7 +145,7 @@ class Pages
*/
public function baseRoute($lang = null)
{
$key = $lang ?: 'default';
$key = $lang ?: $this->active_lang ?: 'default';
if (!isset($this->baseRoute[$key])) {
/** @var Language $language */
@@ -968,6 +970,9 @@ class Pages
$pages_dir = $locator->findResource('page://');
// Set active language
$this->active_lang = $language->getActive();
if ($config->get('system.cache.enabled')) {
/** @var Cache $cache */
$cache = $this->grav['cache'];