You are here

class DomainServiceProvider in Domain Access 8

Overrides the router.route_provider service.

Point to our customized one and adds url.site to the required_cache_contexts renderer configuration.

Hierarchy

Expanded class hierarchy of DomainServiceProvider

See also

https://www.drupal.org/node/2662196#comment-10838164

File

domain/src/DomainServiceProvider.php, line 17

Namespace

Drupal\domain
View source
class DomainServiceProvider extends ServiceProviderBase implements ServiceModifierInterface {

  /**
   * {@inheritdoc}
   */
  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);
    }
  }

}

Members

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