You are here

public function ContextServiceProvider::alter in Context 8

Same name and namespace in other branches
  1. 8.4 src/ContextServiceProvider.php \Drupal\context\ContextServiceProvider::alter()

Modifies existing service definitions.

Parameters

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

Overrides ServiceProviderBase::alter

File

src/ContextServiceProvider.php, line 16

Class

ContextServiceProvider
Alter the service container to use a custom class.

Namespace

Drupal\context

Code

public function alter(ContainerBuilder $container) {

  // Override the menu active trail with a new class.
  $definition = $container
    ->getDefinition('menu.active_trail');
  $definition
    ->setClass('Drupal\\context\\ContextMenuActiveTrail');
  $definition
    ->addArgument($container
    ->getDefinition('context.manager'));
}