diff --git a/src/EventSubscriber/FrontPageSubscriber.php b/src/EventSubscriber/FrontPageSubscriber.php index 430b51f..0331ce4 100644 --- a/src/EventSubscriber/FrontPageSubscriber.php +++ b/src/EventSubscriber/FrontPageSubscriber.php @@ -6,6 +6,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Drupal\Core\Url; class FrontPageSubscriber implements EventSubscriberInterface { @@ -47,7 +48,9 @@ class FrontPageSubscriber implements EventSubscriberInterface { } if ($front_page) { - $event->setResponse(new RedirectResponse($front_page)); + $current_language = \Drupal::languageManager()->getCurrentLanguage(); + $url = Url::fromUserInput($front_page, ['language' => $current_language]); + $event->setResponse(new RedirectResponse($url->toString())); //@todo Probably we must to remove this and manage cache by role. // Turn caching off for this page as it is dependant on role.