In Drupal 8, I’m trying to get my menu which has translated menu item filtered by a given language.
So far, I was able to get my menu tree :
$menu_parameters = $this->menuLinkTree->getCurrentRouteMenuTreeParameters('main'); $menu_tree = $this->menuLinkTree->load('main', $menu_parameters); $manipulators = array( // Only show links that are accessible for the current user. array('callable' => 'menu.default_tree_manipulators:checkAccess'), // Use the default sorting of menu links. array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'), ); $menu_tree = $this->menuLinkTree->transform($menu_tree, $manipulators);
But I still have “stand alone” links in both language.
I looked into manipulators and parameters, but couldn’t see anything related to translation.
Maybe using MenuTreeParameters::addCondition, but i’m missing something here.
Any help would be greatly appreciated.