I load my main menu programmatically with the following code :
$menuTree = \Drupal::menuTree(); $menuTreeParameters = $menuTree->getCurrentRouteMenuTreeParameters($name); $menuTreeParameters ->setMinDepth($minLevel) ->setMaxDepth($maxLevel); $tree = $menuTree->load($name, $menuTreeParameters); $tree = $menuTree->transform($tree, $this->getDefaultManipulators()); return render($menuTree->build($tree));
I would like to get all my menu items, included thoses which are disabled. When I inspect $tree variable, I have all my menu items.
I don't know why but after the call to the build method, I get only my enabled items.