Loading src/EventSubscriber/RedirectNodeRouteSubscriber.php +8 −6 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ class RedirectNodeRouteSubscriber implements EventSubscriberInterface { * The GetResponseEvent to process. */ public function redirectNodeUrl(GetResponseEvent $event) { $config = $this->configFactory->get('system.site'); $pageSlashNode = $config->get('site_disable_page_node'); Loading @@ -61,19 +60,23 @@ class RedirectNodeRouteSubscriber implements EventSubscriberInterface { $request = $event->getRequest(); $getRequestUri = $request->getRequestUri(); $getLanguage = $this->languageManager->getCurrentLanguage(); $validUris = [ '/node', '/' . $getLanguage->getId() . '/node', ]; if ($getRequestUri === '/node') { // Check Uri to see if it's valid for processing if (in_array($getRequestUri, $validUris)) { $options = []; if ($this->languageManager->isMultilingual()) { $getLanguage = $this->languageManager->getCurrentLanguage(); $options = ['language' => $getLanguage]; } $pageSlashNode404 = $config->get('site_disable_page_node_404'); if ($pageSlashNode404) { // only return a response for a master request // Only return a response for a master request if ($event->isMainRequest()) { throw new NotFoundHttpException(); } Loading @@ -83,7 +86,6 @@ class RedirectNodeRouteSubscriber implements EventSubscriberInterface { $response = new RedirectResponse($url->toString()); $response->send(); } } } } Loading Loading
src/EventSubscriber/RedirectNodeRouteSubscriber.php +8 −6 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ class RedirectNodeRouteSubscriber implements EventSubscriberInterface { * The GetResponseEvent to process. */ public function redirectNodeUrl(GetResponseEvent $event) { $config = $this->configFactory->get('system.site'); $pageSlashNode = $config->get('site_disable_page_node'); Loading @@ -61,19 +60,23 @@ class RedirectNodeRouteSubscriber implements EventSubscriberInterface { $request = $event->getRequest(); $getRequestUri = $request->getRequestUri(); $getLanguage = $this->languageManager->getCurrentLanguage(); $validUris = [ '/node', '/' . $getLanguage->getId() . '/node', ]; if ($getRequestUri === '/node') { // Check Uri to see if it's valid for processing if (in_array($getRequestUri, $validUris)) { $options = []; if ($this->languageManager->isMultilingual()) { $getLanguage = $this->languageManager->getCurrentLanguage(); $options = ['language' => $getLanguage]; } $pageSlashNode404 = $config->get('site_disable_page_node_404'); if ($pageSlashNode404) { // only return a response for a master request // Only return a response for a master request if ($event->isMainRequest()) { throw new NotFoundHttpException(); } Loading @@ -83,7 +86,6 @@ class RedirectNodeRouteSubscriber implements EventSubscriberInterface { $response = new RedirectResponse($url->toString()); $response->send(); } } } } Loading