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 → created an issue.
oliverpolden → created an issue.
With further testing I've found the following:
- Position cursor, click button to insert token: "First click a text field to insert your tokens into."
- Close token browser.
- Position cursor, click button to insert token: Success.
This also works if you click the token browser button, close the token browser, position the cursor again and then click the button.
It seems initially drupalSettings.tokenFocusedCkeditor5 is undefined in token.js:Drupal.behaviors.tokenInsert, so it drops out into the last else {}:
alert(Drupal.t('First click a text field to insert your tokens into.'));
And with some debugging, I can see that the drupalSettings.tokenFocusedCkeditor5 = editor;
isn't initially called:
if (Drupal.CKEditor5Instances) {
Drupal.CKEditor5Instances.forEach(function (editor) {
editor.editing.view.document.on('change:isFocused', (event, data, isFocused) => {
if (isFocused) {
drupalSettings.tokenFocusedCkeditor5 = editor;
}
});
})
}
I've been trying this in combination with the patch for #3334784.
The button works to show the token browser but when I click a token to insert it I get a JS popup:
First click a text field to insert your tokens into.
I'm definitely putting the cursor in the text area first. I do notice that the cursor seems to disappear immediately upon clicking the button but in CKEditor 4 the cursor stays flashing until the token browser appears or at least until a "Loading" popup appears at the top of the text area.
I also get an error in the browser console:
Uncaught TypeError: can't access property "contains", event.target.classList is undefined
_allowInteraction ckeditor5.dialog.fix.js:10
I don't know if this is particular to my install. Does anyone else get this issue?
This is a patch to simply allow year(curdate()) in the year field. This would need a bit more work to at a minimum add some help text to that effect but at least this works.
oliverpolden → created an issue.