mirror of
https://github.com/getgrav/grav.git
synced 2026-07-04 12:49:06 +02:00
Added language support to the initializeFromUrl() method
This commit is contained in:
@@ -197,6 +197,10 @@ class Uri
|
||||
$this->root = [];
|
||||
$this->url = [];
|
||||
|
||||
$grav = Grav::instance();
|
||||
|
||||
$language = $grav['language'];
|
||||
|
||||
$params = Uri::parseUrl($url);
|
||||
|
||||
$this->name = $params['host'];
|
||||
@@ -204,6 +208,9 @@ class Uri
|
||||
|
||||
$this->uri = $params['path'];
|
||||
|
||||
// set active language
|
||||
$uri = $language->setActiveFromUri($this->uri);
|
||||
|
||||
if (isset($params['params'])) {
|
||||
$this->params($params['params']);
|
||||
}
|
||||
@@ -218,7 +225,8 @@ class Uri
|
||||
$this->env = $this->buildEnvironment();
|
||||
$this->root_path = $this->buildRootPath();
|
||||
$this->root = $this->base . $this->root_path;
|
||||
$this->url = $this->base . $this->uri;
|
||||
$this->url = $this->root . $uri;
|
||||
$this->path = $uri;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user