function MenuLinkTree::__construct

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkTree.php \Drupal\Core\Menu\MenuLinkTree::__construct()
  2. 8.9.x core/lib/Drupal/Core/Menu/MenuLinkTree.php \Drupal\Core\Menu\MenuLinkTree::__construct()
  3. 11.x core/lib/Drupal/Core/Menu/MenuLinkTree.php \Drupal\Core\Menu\MenuLinkTree::__construct()

Constructs a \Drupal\Core\Menu\MenuLinkTree object.

Parameters

\Drupal\Core\Menu\MenuTreeStorageInterface $tree_storage: The menu link tree storage.

\Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager: The menu link plugin manager.

\Drupal\Core\Routing\RouteProviderInterface $route_provider: The route provider to load routes by name.

\Drupal\Core\Menu\MenuActiveTrailInterface $menu_active_trail: The active menu trail service.

\Drupal\Core\Utility\CallableResolver|\Drupal\Core\Controller\ControllerResolverInterface $callable_resolver: The callable resolver.

File

core/lib/Drupal/Core/Menu/MenuLinkTree.php, line 68

Class

MenuLinkTree
Implements the loading, transforming and rendering of menu link trees.

Namespace

Drupal\Core\Menu

Code

public function __construct(MenuTreeStorageInterface $tree_storage, MenuLinkManagerInterface $menu_link_manager, RouteProviderInterface $route_provider, MenuActiveTrailInterface $menu_active_trail, ControllerResolverInterface|CallableResolver $callable_resolver) {
    $this->treeStorage = $tree_storage;
    $this->menuLinkManager = $menu_link_manager;
    $this->routeProvider = $route_provider;
    $this->menuActiveTrail = $menu_active_trail;
    if ($callable_resolver instanceof ControllerResolverInterface) {
        @trigger_error('Calling ' . __METHOD__ . '() with an argument of ControllerResolverInterface is deprecated in drupal:10.2.0 and is removed in drupal:11.0.0. Use \\Drupal\\Core\\Utility\\CallableResolver instead. See https://www.drupal.org/node/3395294', E_USER_DEPRECATED);
        $callable_resolver = \Drupal::service('callable_resolver');
    }
    $this->callableResolver = $callable_resolver;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.