bug fix MaterioDecoupledLanguageLinks
This commit is contained in:
parent
9184283a17
commit
1634750ec5
|
@ -53,17 +53,17 @@ class MaterioDecoupledLanguageLinks extends ControllerBase {
|
||||||
// build the links
|
// build the links
|
||||||
$url_object = \Drupal::service('path.validator')->getUrlIfValid($path);
|
$url_object = \Drupal::service('path.validator')->getUrlIfValid($path);
|
||||||
|
|
||||||
$languages = $this->languageManager->getNativeLanguages();
|
|
||||||
if (!$url_object) {
|
if (!$url_object) {
|
||||||
// if path does not exists
|
// if path does not exists
|
||||||
$data["error"] = "path {$path} is not valid";
|
$data["error"] = "path {$path} is not valid";
|
||||||
$route_name = "<front>";
|
$route_name = "<front>";
|
||||||
$route_parameters = null;
|
$route_parameters = array();
|
||||||
}else{
|
}else{
|
||||||
$route_name = $url_object->getRouteName();
|
$route_name = $url_object->getRouteName();
|
||||||
$route_parameters = $url_object->getrouteParameters();
|
$route_parameters = $url_object->getrouteParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$languages = $this->languageManager->getNativeLanguages();
|
||||||
foreach ($languages as $key => $language) {
|
foreach ($languages as $key => $language) {
|
||||||
$url = Url::fromRoute($route_name, $route_parameters, ["language"=>$language]);
|
$url = Url::fromRoute($route_name, $route_parameters, ["language"=>$language]);
|
||||||
$links[$key] = [
|
$links[$key] = [
|
||||||
|
|
Loading…
Reference in New Issue