Skip to content

Commit

Permalink
Add condition with current route condition
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Sep 4, 2024
1 parent 61b6563 commit d49d6e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Kernel/SyliusNoCommerceKernelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
foreach ($collection as $name => $route) {
foreach ($routesToRemove as $routeToRemove) {
if (false !== strpos($name, $routeToRemove)) {
$route->setCondition('not context.checkNoCommerce()');
$routeCondition = $route->getCondition();
if ($routeCondition && false === strpos($routeCondition, 'not context.checkNoCommerce()')) {
$route->setCondition($routeCondition . ' and not context.checkNoCommerce()');
} elseif (!$routeCondition) {
$route->setCondition('not context.checkNoCommerce()');
}
}
}
}
Expand Down

0 comments on commit d49d6e5

Please sign in to comment.