You are here

public function MenuItems::setActiveMenuTree in Simplify Menu 8.2

Loads up the current active menu tree and sets it to a variable.

Parameters

string $menu_id: The id of the menu to check for active links.

1 call to MenuItems::setActiveMenuTree()
MenuItems::getMenuTree in src/MenuItems.php
Get header menu links.

File

src/MenuItems.php, line 136

Class

MenuItems
Class MenuItems.

Namespace

Drupal\simplify_menu

Code

public function setActiveMenuTree(string $menu_id) : void {
  $menu_tree = \Drupal::menuTree();
  $parameters = \Drupal::menuTree()
    ->getCurrentRouteMenuTreeParameters($menu_id);
  $loaded_tree = $menu_tree
    ->load($menu_id, $parameters);
  $this->activeMenuTree = $this
    ->checkActiveTrail($loaded_tree);
}