Commit 48036208 authored by George Mahoney-Potter's avatar George Mahoney-Potter Committed by Ivan
Browse files

Issue #3222666 by gpotter, theRuslan, Chi, smustgrave, superbiche,...

Issue #3222666 by gpotter, theRuslan, Chi, smustgrave, superbiche, letrollpoilu: drupal_menu() incorrectly caches the active parent menu item in two-leveled menu
parent 68bb4e55
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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;
  }

  /**