Skip to content

Commit

Permalink
Ensure that only trail or active class is set
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus committed Sep 26, 2024
1 parent b36a8f9 commit 17b5ee4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Renderer/NavigationRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,17 @@ private function renderTree(
$containsActive = true;

if ($item['href'] === Environment::get('request')) {
$item['isActive'] = true; // nothing else (active class is set in template)
$item['isActive'] = true; // nothing else (active class is set in template)
$item['isInTrail'] = false;
} else {
$item['isInTrail'] = true;
}
} else { // do not flatten if/else
/** @psalm-suppress RiskyTruthyFalsyComparison */
if (isset($item['tid']) && $item['tid'] === $activeId) {
if ($item['href'] === Environment::get('request')) {
$item['isActive'] = true; // nothing else (active class is set in template)
$item['isActive'] = true; // nothing else (active class is set in template)
$item['isInTrail'] = false;
} else {
$item['isInTrail'] = true;
}
Expand Down

0 comments on commit 17b5ee4

Please sign in to comment.