Browse Source

Issue #3222666 by gpotter, theRuslan, Chi, smustgrave, superbiche, letrollpoilu: drupal_menu() incorrectly caches the active parent menu item in two-leveled menu

8.x-2.x 8.x-2.10
George Potter 2 years ago committed by Chi
parent
commit
4803620832
  1. 7
      src/TwigExtension.php

7
src/TwigExtension.php

@ -716,7 +716,7 @@ class TwigExtension extends AbstractExtension {
$parameters->setMinDepth($level);
// When the depth is configured to zero, there is no depth limit. When depth
// is non-zero, it indicates the number of levels that must be displayed.
// Hence this is a relative depth that we must convert to an actual
// Hence, this is a relative depth that we must convert to an actual
// (absolute) depth, that may never exceed the maximum depth.
if ($depth > 0) {
$parameters->setMaxDepth(min($level + $depth - 1, $menu_tree->maxDepth()));
@ -733,7 +733,10 @@ class TwigExtension extends AbstractExtension {
['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'],
];
$tree = $menu_tree->transform($tree, $manipulators);
return $menu_tree->build($tree);
$build = $menu_tree->build($tree);
$build['#cache']['contexts'][] = 'route.menu_active_trails:' . $menu_name;
return $build;
}
/**

Loading…
Cancel
Save