You are here

class ContextServiceProvider in Context 8

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

Alter the service container to use a custom class.

Hierarchy

Expanded class hierarchy of ContextServiceProvider

File

src/ContextServiceProvider.php, line 11

Namespace

Drupal\context
View source
class ContextServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  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'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContextServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceProviderBase::alter
ServiceProviderBase::register public function Registers services to the container. Overrides ServiceProviderInterface::register 1