You are here

public function MenuPositionServiceProvider::alter in Menu Position 8

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceProviderBase::alter

File

src/MenuPositionServiceProvider.php, line 17

Class

MenuPositionServiceProvider
Menu Position service provider.

Namespace

Drupal\menu_position

Code

public function alter(ContainerBuilder $container) {

  // Override the menu active trail with a new class.
  $definition = $container
    ->getDefinition('menu.active_trail');
  $definition
    ->setClass('Drupal\\menu_position\\Menu\\MenuPositionActiveTrail');
  $definition
    ->addArgument(new Reference('entity_type.manager'));
  $definition
    ->addArgument(new Reference('config.factory'));
}