public function BricksServiceProvider::alter in Bricks 8
Same name and namespace in other branches
- 2.x src/BricksServiceProvider.php \Drupal\bricks\BricksServiceProvider::alter()
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceProviderBase::alter
File
- src/
BricksServiceProvider.php, line 18
Class
- BricksServiceProvider
- Service Provider for Bricks.
Namespace
Drupal\bricksCode
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);
}
}