You are here

class BricksServiceProvider in Bricks​ 8

Same name and namespace in other branches
  1. 2.x src/BricksServiceProvider.php \Drupal\bricks\BricksServiceProvider

Service Provider for Bricks.

Hierarchy

Expanded class hierarchy of BricksServiceProvider

File

src/BricksServiceProvider.php, line 13

Namespace

Drupal\bricks
View source
class BricksServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $modules = $container
      ->getParameter('container.modules');

    // Check for installed Replicate module.
    if (isset($modules['replicate'])) {

      // Add a Replicate field event subscriber.
      $service_definition = new Definition('Drupal\\bricks\\EventSubscriber\\ReplicateFieldSubscriber', [
        new Reference('replicate.replicator'),
      ]);
      $service_definition
        ->addTag('event_subscriber');
      $service_definition
        ->setPublic(TRUE);
      $container
        ->setDefinition('replicate.event_subscriber.bricks', $service_definition);
    }
  }

}

Members

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