Skip to content

Commit

Permalink
Merge pull request #3 from oliverschroeder/main
Browse files Browse the repository at this point in the history
[BUGFIX] Language is taken into account when generating the source path
  • Loading branch information
georgringer authored Jul 31, 2023
2 parents bf8b152 + 598b99a commit c4dfd28
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Classes/Service/SlugService.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function createRedirect(string $originalSlug, int $recordId, int $lang
'parameters' => '_language=' . $languageId . '&tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]=' . $recordId,
]);

$sourcePath = $this->generateUrl($this->site, $recordId, $this->targetPageId);
$sourcePath = $this->generateUrl($this->site, $recordId, $this->targetPageId, $languageId);
$sourcePath = '/' . ltrim(str_replace(['http://', 'https://', $siteLanguage->getBase()->getHost()], '', $sourcePath), '/');

$record = [
Expand Down Expand Up @@ -126,14 +126,15 @@ protected function createRedirect(string $originalSlug, int $recordId, int $lang
}


protected function generateUrl(SiteInterface $site, int $recordId, int $detailPageId): string
protected function generateUrl(SiteInterface $site, int $recordId, int $detailPageId, int $languageId): string
{
$additionalQueryParams = [
'tx_news_pi1' => [
'action' => 'detail',
'controller' => 'News',
'news' => $recordId
]
],
'_language' => $languageId
];
return (string)$site->getRouter()->generateUri(
(string)$detailPageId,
Expand Down

0 comments on commit c4dfd28

Please sign in to comment.