You are here

public function TomeSyncServiceProvider::register in Tome 8

Registers services to the container.

Parameters

ContainerBuilder $container: The ContainerBuilder to register services to.

Overrides ServiceProviderInterface::register

File

modules/tome_sync/src/TomeSyncServiceProvider.php, line 21

Class

TomeSyncServiceProvider
Registers services in the container.

Namespace

Drupal\tome_sync

Code

public function register(ContainerBuilder $container) {
  $modules = $container
    ->getParameter('container.modules');
  if (isset($modules['language'])) {
    $container
      ->register('tome_sync.language_config_event_subscriber', LanguageConfigEventSubscriber::class)
      ->addTag('event_subscriber')
      ->addArgument(new Reference('config.storage.sync'));
  }
  if (isset($modules['book'])) {
    $container
      ->register('tome_sync.book_event_subscriber', BookEventSubscriber::class)
      ->addTag('event_subscriber')
      ->addArgument(new Reference('database'))
      ->addArgument(new Reference('entity_type.manager'))
      ->addArgument(new Reference('file_system'));
  }
}