- Issue created by @arisen
Hello
Did you try this ? It works for me.function your_module_preprocess_email_wrap(array &$variables) { $config = \Drupal::config('system.site'); $variables['site_name'] = $config->get('name'); }
- 🇮🇳India arisen Goa
Hi @seda12 yes that works fine if we write the preprocess in our custom module.
But the question is to make it work without having to do the preprocessing in custom module. So expecting a confirmation from the project maintainer about the correct approach. - 🇮🇳India himanshu_jhaloya Indore
Try this
function mymodule_preprocess_email_wrap(&$variables) {
$email = $variables['email'];
$variables = array_merge($variables, $email->getVariables());
} - 🇬🇧United Kingdom adamps
This was done like this deliberately.
The idea is that the variables should be replaced in the "normal" template. The wrap template is aimed to be generic, not related to the contents of the email.
Please can you explain why you can't use it that way?
- 🇨🇦Canada phjou Vancouver 🇨🇦 🇪🇺
I encountered the same issue, but I found a way out, I could access all my variables that have been passed to the email.
/** * Prepares variables for email wrap template. */ function my_module_preprocess_email_wrap(array &$variables) { $email = $variables['email']; $message = $email->getParam('legacy_message'); $params = $message['params']['extra']; }