From b4c00400fac0dacddbbc59ad2cd551c6bf09829d Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Wed, 9 Oct 2024 15:26:37 +0200 Subject: [PATCH] Reduce calls in SlugRouter --- src/Kunstmaan/NodeBundle/Router/SlugRouter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kunstmaan/NodeBundle/Router/SlugRouter.php b/src/Kunstmaan/NodeBundle/Router/SlugRouter.php index 41211af5f6..30568bab08 100644 --- a/src/Kunstmaan/NodeBundle/Router/SlugRouter.php +++ b/src/Kunstmaan/NodeBundle/Router/SlugRouter.php @@ -182,7 +182,6 @@ protected function getPreviewRouteParameters() '_controller' => SlugController::class . '::slugAction', 'preview' => true, 'url' => '', - '_locale' => $this->getDefaultLocale(), ]; $previewRequirements = [ 'url' => $this->getSlugPattern(), @@ -190,8 +189,9 @@ protected function getPreviewRouteParameters() if ($this->isMultiLanguage()) { $previewPath = '/{_locale}' . $previewPath; - unset($previewDefaults['_locale']); $previewRequirements['_locale'] = $this->getEscapedLocales($this->getBackendLocales()); + } else { + $previewDefaults['_locale'] = $this->getDefaultLocale(); } return [ @@ -213,7 +213,6 @@ protected function getSlugRouteParameters() '_controller' => SlugController::class . '::slugAction', 'preview' => false, 'url' => '', - '_locale' => $this->getDefaultLocale(), ]; $slugRequirements = [ 'url' => $this->getSlugPattern(), @@ -221,8 +220,9 @@ protected function getSlugRouteParameters() if ($this->isMultiLanguage()) { $slugPath = '/{_locale}' . $slugPath; - unset($slugDefaults['_locale']); $slugRequirements['_locale'] = $this->getEscapedLocales($this->getFrontendLocales()); + } else { + $slugDefaults['_locale'] = $this->getDefaultLocale(); } return [