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