Skip to content

Commit

Permalink
Do not use sprintf to generate URLs (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Aug 17, 2024
1 parent c7ab3a6 commit 3ec06c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/FrontendModule/CumulativeFilterModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ protected function renderNewsCategories($pid, array $ids, $isActiveCategories =
}
}

$resetUrl = $this->getTargetPage()->getFrontendUrl();
$pageUrl = $this->getTargetPage()->getFrontendUrl(\sprintf('/%s', $this->manager->getParameterName($GLOBALS['objPage']->rootId)).'/%s');
$targetPage = $this->getTargetPage();
$baseParam = '/'.$this->manager->getParameterName($GLOBALS['objPage']->rootId).'/';
$resetUrl = $targetPage->getFrontendUrl();

/** @var NewsCategoryModel $category */
foreach ($categories as $category) {
Expand All @@ -137,7 +138,7 @@ protected function renderNewsCategories($pid, array $ids, $isActiveCategories =

// Generate the category URL if there are any aliases to add, otherwise use the reset URL
if (\count($aliases) > 0) {
$url = \sprintf($pageUrl, implode(static::getCategorySeparator(), $aliases));
$url = $targetPage->getFrontendUrl($baseParam.implode(static::getCategorySeparator(), $aliases));
} else {
$url = $resetUrl;
}
Expand Down

0 comments on commit 3ec06c4

Please sign in to comment.