getpathtranslation invalid path temporary workarround
This commit is contained in:
@@ -51,6 +51,14 @@ class MaterioDecoupledLanguageLinks extends ControllerBase {
|
||||
|
||||
// build the links
|
||||
$url_object = \Drupal::service('path.validator')->getUrlIfValid($path);
|
||||
// Call to a member function getRouteName() on bool in Drupal\materio_decoupled\Controller\MaterioDecoupledLanguageLinks->getPathTranslationLinks()
|
||||
if (!$url_object) {
|
||||
// if path does not exists rtuen an error
|
||||
return new JsonResponse(array(
|
||||
"links" = [],
|
||||
"error" = "path {$path} is not valid"
|
||||
));
|
||||
}
|
||||
$route_name = $url_object->getRouteName();
|
||||
$route_parameters = $url_object->getrouteParameters();
|
||||
$languages = $this->languageManager->getNativeLanguages();
|
||||
|
Reference in New Issue
Block a user