You are here

public function MenuTokenServiceProvider::alter in Menu Token 8

Same name and namespace in other branches
  1. 9.1.x src/MenuTokenServiceProvider.php \Drupal\menu_token\MenuTokenServiceProvider::alter()

Override menu.link_tree service.

Parameters

\Drupal\Core\DependencyInjection\ContainerBuilder $container: Dep container.

Overrides ServiceProviderBase::alter

File

src/MenuTokenServiceProvider.php, line 22

Class

MenuTokenServiceProvider
Class MyModuleServiceProvider.

Namespace

Drupal\menu_token

Code

public function alter(ContainerBuilder $container) {
  $definition = $container
    ->getDefinition('menu.link_tree');
  $definition
    ->setClass('Drupal\\menu_token\\Service\\MenuLinkTreeMenuToken');
  $definition
    ->setArguments([
    new Reference('menu.tree_storage'),
    new Reference('plugin.manager.menu.link'),
    new Reference('router.route_provider'),
    new Reference('menu.active_trail'),
    new Reference('controller_resolver'),
  ]);
}