Skip to content
Snippets Groups Projects
Commit 32920b2f authored by Ken Rickard's avatar Ken Rickard
Browse files

Fix for #3048554.

parent 0d58b9e2
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,9 @@ interface DomainNegotiatorInterface {
/**
* Gets the active domain.
*
* If the domain has not been calculated, it will be. You can also force
* recalculation by passing $reset = TRUE, but that is discouraged.
*
* This method should be called by external classes using the negotiator
* service.
*
......
......@@ -97,7 +97,7 @@ function domain_alias_domain_load($entities) {
$active = $negotiator->getActiveDomain();
// Do nothing if no domain is active.
if (is_null($active)) {
if (empty($active)) {
return;
}
......
......@@ -197,6 +197,10 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
// 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.
......@@ -206,16 +210,7 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
// The same issue is true for the domainNegotiator.
$this->domainNegotiator = \Drupal::service('domain.negotiator');
// Get the domain context.
$this->domain = $this->domainNegotiator->getActiveDomain();
// If we have fired too early in the bootstrap, we must force the routine to
// run.
if (empty($this->domain)) {
$this->domain = $this->domainNegotiator->getActiveDomain(TRUE);
// Ensure the module hook cache is set properly.
// See https://www.drupal.org/project/domain/issues/3025541
$this->moduleHandler->resetImplementations();
}
$this->domain = $this->domainNegotiator->getActiveDomain(TRUE);
}
}
......@@ -10,7 +10,7 @@ use Drupal\domain\DomainInterface;
/**
* Implements hook_domain_request_alter().
*/
function domain_config_test_domain_request_alter(DomainInterface &$domain) {
function domain_config_test_domain_request_alter(DomainInterface $domain) {
$domain->addProperty('config_test', 'aye');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment