Skip to content

Commit

Permalink
Merge pull request #2532 from bolt/bugfix/locale-link-parameter-override
Browse files Browse the repository at this point in the history
Locale get link always `_locale` parameter
  • Loading branch information
bobdenotter authored Apr 21, 2021
2 parents 4c0d0a6 + 8c8492a commit d61c778
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/Utils/LocaleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,11 @@ private function getContentLocales(): array

private function getLink(string $route, array $routeParams, Collection $locale): string
{
switch ($route) {
case 'record':
case 'homepage':
case 'listing':
case 'search':
case 'taxonomy':
$route = $route .= '_locale';
// no break
case 'record_locale':
case 'homepage_locale':
case 'listing_locale':
case 'search_locale':
case 'taxonomy_locale':
$routeParams['_locale'] = $locale->get('code');

break;
default:
$routeParams['edit_locale'] = $locale->get('code');
$routeParams['_locale'] = $locale->get('code');

if ($route === 'bolt_content_edit') {
unset($routeParams['_locale']);
$routeParams['edit_locale'] = $locale->get('code');
}

return $this->urlGenerator->generate($route, $routeParams);
Expand Down

0 comments on commit d61c778

Please sign in to comment.