If I use Drupal::menuTree() to load a menu it seems to always have inActiveTrail set to FALSE for all my items.
As an example consider the following code:
$menu_tree = Drupal::menuTree(); $parameters = new MenuTreeParameters(); $parameters->setTopLevelOnly(); $main_menu_top_level = $menu_tree->load('main', $parameters);
That code returns the top level of the main menu with inActiveTrail = FALSE for all items regardless of what page I am on.
I believe MenuTreeParameters::setActiveTrail() is meant to help here but then I have to pass in an active trail.
How do I get the active menu trail for the current page load so I can then pass it in?