Drupal Version

8.x +

Domain module version

8.x +

Expected Behavior

I have a drush command that brings in content and assigns it to a domain. I also have Mailchimp with config per domain. I need my drush command to be able to set the domain that is used for the config override. I expect there to be a way to set the active domain so that when Mailchimp loads its config, it loads the config for the domain I have set.

Actual Behavior

There doesn't appear to be a way to set the domain to be used for config override.

Steps to reproduce

Issue fork domain-3385946

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

oliverpolden created an issue. See original summary.

oliverpolden’s picture

With this you can inject the domainConfigOverrider (domain_config.overrider) service and then do:

// Load the domain you want.
$domain = $this->myFunctionToLoadADomain($params);
$this->domainConfigOverrider->setDomain($domain);

I have tested this by creating an entity from my primary domain with settings on the entity that relate to two different domains. I have an event subscriber on entity insert that determines the domain and triggers a MailChimp campaign. The MailChimp module successfully loads the config for the relevant domain.

oliverpolden’s picture

Issue summary: View changes

mably made their first commit to this issue’s fork.

mably’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Active » Fixed

Merged, thanks!

You might have to call initiateContext() before using the setDomain() method.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.