You are here

public function CoreContextServiceProvider::register in Core Context 8

Registers services to the container.

Parameters

ContainerBuilder $container: The ContainerBuilder to register services to.

Overrides ServiceProviderInterface::register

File

src/CoreContextServiceProvider.php, line 17

Class

CoreContextServiceProvider
Registers container services on behalf of Core Context.

Namespace

Drupal\core_context

Code

public function register(ContainerBuilder $container) {
  $modules = $container
    ->getParameter('container.modules');
  if (isset($modules['layout_builder'])) {
    $container
      ->register('core_context.render_section_component_subscriber')
      ->setClass(EventSubscriber\SectionComponentRenderArray::class)
      ->setArguments([
      new Reference('plugin.manager.layout_builder.section_storage'),
      new Reference('entity_type.manager'),
    ])
      ->addTag('event_subscriber');
    $container
      ->register('core_context.layout_builder')
      ->setClass(ContextProvider\LayoutBuilder::class)
      ->setArguments([
      new Reference('entity_display.repository'),
      new Reference('core_context.canonical_entity'),
      new Reference('current_route_match'),
      new Reference('entity_type.manager'),
    ])
      ->addTag('core_context.context_provider');
  }
}