I have not found documentation about how to send values for template regions. After a little research I know how to do it: adding the data in the 'mandrill_template_content' key of the $message varaible in a hook_mail_alter().
I think this information should be added to the module in the README.txt.
I propose add this paragraph:
To send values from Drupal to Mandrill that will be used to substitute the
template regions you should implement hook_mail_alter() and add your values in
the 'mandrill_template_content' key in the $message array as an array with two
keys: name and content.For example, for sending the value 'foo value' for the region 'foo' you
can use this code:/**
* Implements hook_mail_alter();
*/
function mymodule_mail_alter(&$message) {
$message['mandrill_template_content'][] = array(
'name' => 'foo',
'content' => 'foo value',
);
}
Comment | File | Size | Author |
---|---|---|---|
#8 | mandrill-document_sending_region_values-2361027-8.patch | 1.39 KB | tunic |
Comments
Comment #1
tunicPatch added.
Comment #2
David Hernández CreditAttribution: David Hernández commentedMarking it as RTBC. That documentation is necessary in order to make this work. Maybe it's also necessary to create a documentation page, here on drupal.org
Comment #3
mr_christopher CreditAttribution: mr_christopher commentedComment #4
ruscoe CreditAttribution: ruscoe commentedThis is a good addition, but was removing the Mandrill library installation instructions intentional?
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedAm going to reroll this with the installation instructions restored, and commit it. Thanks for the patch!
Comment #6
tunicOops, I didn't notice I removed the library installation instructions.
@6c1, I can reroll the patch if you want.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedHi @tunic; that would be great. Thanks!
Comment #8
tunicPatched rerrolled, now it just includes the new paragraph.
Comment #9
levelos CreditAttribution: levelos at ThinkShout commentedComment #12
vonFrakas CreditAttribution: vonFrakas commentedDrupal 9:
As mentioned by @marthinal in #3 here, https://www.drupal.org/project/mandrill/issues/2815947#comment-12700364, for D9 it needs to be: