Skip to content

Commit

Permalink
Avoid incorrect locale while getting fullname in the root taxon
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Jun 19, 2024
1 parent c79b19c commit f05ec2d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Provider/TaxonUrlProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ protected function addItemFromResult(object $result, string $locale): void
Assert::isInstanceOf($result, TaxonInterface::class);
/** @var TaxonInterface $result */
$result->setCurrentLocale($locale);

// Avoid incorrect locale while getting fullname in the root taxon
if (!$result->isRoot()) {
$result->getRoot()?->setCurrentLocale($locale);
}

$this->addItem(
(string) $result->getFullname(' > '),
$this->router->generate('sylius_shop_product_index', ['slug' => $result->getSlug(), '_locale' => $locale])
Expand Down

0 comments on commit f05ec2d

Please sign in to comment.