You are here

ContextServiceProvider.php in Context 8

Same filename and directory in other branches
  1. 8.4 src/ContextServiceProvider.php

Namespace

Drupal\context

File

src/ContextServiceProvider.php
View source
<?php

namespace Drupal\context;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;

/**
 * Alter the service container to use a custom class.
 */
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'));
  }

}

Classes

Namesort descending Description
ContextServiceProvider Alter the service container to use a custom class.