How do I name a mimemail-message.tpl.php template to be used with a specific webform?
Question
I cant seem to get the naming of the mimemail-message.tpl.php
correct in Drupal 7. I know the naming scheme says "mimemail-message--[module]--[key].tpl.php"
but either I'm not understanding what the brackets represent or I'm doing something else wrong.
I've tried:
mimemail-message--webform--mywebformname.tpl.php
mimemail-message--webform--250.tpl.php
Just mimemail-message.tpl.php
works, but I need different template layout depending on which webform is used.
Also, is mime mail not supposed to make use of webform-mail-250.tpl.php
at all?
Solution
As you can see in line 264 of webform.submissions.inc Webform uses submission
as the key.
Thus it needs to be named
mimemail-message--webform--submission.tpl.php
There is no way to target a specific webform without some extra custom code work.
mymodule.module
function mymodule_mail_alter(&$message) {
if ($message['module'] == 'webform') {
$nid = $message['params']['node']->nid;
$message['key'] = $nid; // set key to nid
}
}
Now you can do
mimemail-message--webform--250.tpl.php
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange