You are here

public function DomainServiceProvider::alter in Domain Access 8

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceProviderBase::alter

File

domain/src/DomainServiceProvider.php, line 22

Class

DomainServiceProvider
Overrides the router.route_provider service.

Namespace

Drupal\domain

Code

public function alter(ContainerBuilder $container) {

  // Add the site context to the render cache.
  if ($container
    ->hasParameter('renderer.config')) {
    $renderer_config = $container
      ->getParameter('renderer.config');
    if (!in_array('url.site', $renderer_config['required_cache_contexts'])) {
      $renderer_config['required_cache_contexts'][] = 'url.site';
    }
    $container
      ->setParameter('renderer.config', $renderer_config);
  }
}