Skip to content

Commit

Permalink
Reduce calls in SlugRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny van Wijk committed Oct 9, 2024
1 parent 4263384 commit b4c0040
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Kunstmaan/NodeBundle/Router/SlugRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ protected function getPreviewRouteParameters()
'_controller' => SlugController::class . '::slugAction',
'preview' => true,
'url' => '',
'_locale' => $this->getDefaultLocale(),
];
$previewRequirements = [
'url' => $this->getSlugPattern(),
];

if ($this->isMultiLanguage()) {
$previewPath = '/{_locale}' . $previewPath;
unset($previewDefaults['_locale']);
$previewRequirements['_locale'] = $this->getEscapedLocales($this->getBackendLocales());
} else {
$previewDefaults['_locale'] = $this->getDefaultLocale();
}

return [
Expand All @@ -213,16 +213,16 @@ protected function getSlugRouteParameters()
'_controller' => SlugController::class . '::slugAction',
'preview' => false,
'url' => '',
'_locale' => $this->getDefaultLocale(),
];
$slugRequirements = [
'url' => $this->getSlugPattern(),
];

if ($this->isMultiLanguage()) {
$slugPath = '/{_locale}' . $slugPath;
unset($slugDefaults['_locale']);
$slugRequirements['_locale'] = $this->getEscapedLocales($this->getFrontendLocales());
} else {
$slugDefaults['_locale'] = $this->getDefaultLocale();
}

return [
Expand Down

0 comments on commit b4c0040

Please sign in to comment.