protected function DomainConfigOverrider::initiateContext in Domain Access 8
Sets domain and language contexts for the request.
We wait to do this in order to avoid circular dependencies with the locale module.
2 calls to DomainConfigOverrider::initiateContext()
- DomainConfigOverrider::getCacheableMetadata in domain_config/src/ DomainConfigOverrider.php 
- Gets the cacheability metadata associated with the config factory override.
- DomainConfigOverrider::loadOverrides in domain_config/src/ DomainConfigOverrider.php 
- Returns config overrides.
File
- domain_config/src/ DomainConfigOverrider.php, line 220 
Class
- DomainConfigOverrider
- Domain-specific config overrides.
Namespace
Drupal\domain_configCode
protected function initiateContext() {
  // Prevent infinite lookups by caching the request. Since the _construct()
  // is called for each lookup, this is more efficient.
  $this->contextSet = TRUE;
  // We must ensure that modules have loaded, which they may not have.
  // See https://www.drupal.org/project/domain/issues/3025541.
  $this->moduleHandler
    ->loadAll();
  // Get the language context. Note that injecting the language manager
  // into the service created a circular dependency error, so we load from
  // the core service manager.
  $this->languageManager = \Drupal::languageManager();
  $this->language = $this->languageManager
    ->getCurrentLanguage();
  // The same issue is true for the domainNegotiator.
  $this->domainNegotiator = \Drupal::service('domain.negotiator');
  // Get the domain context.
  $this->domain = $this->domainNegotiator
    ->getActiveDomain(TRUE);
}