You are here

class MenuPositionServiceProvider in Menu Position 8

Menu Position service provider.

Hierarchy

Expanded class hierarchy of MenuPositionServiceProvider

File

src/MenuPositionServiceProvider.php, line 12

Namespace

Drupal\menu_position
View source
class MenuPositionServiceProvider 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\\menu_position\\Menu\\MenuPositionActiveTrail');
    $definition
      ->addArgument(new Reference('entity_type.manager'));
    $definition
      ->addArgument(new Reference('config.factory'));
  }

}

Members

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