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',
);
}

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tunic’s picture

Status: Active » Needs review
FileSize
3.25 KB

Patch added.

David Hernández’s picture

Status: Needs review » Reviewed & tested by the community

Marking 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

mr_christopher’s picture

Issue summary: View changes
ruscoe’s picture

This is a good addition, but was removing the Mandrill library installation instructions intentional?

Anonymous’s picture

Assigned: Unassigned »
Status: Reviewed & tested by the community » Needs work

Am going to reroll this with the installation instructions restored, and commit it. Thanks for the patch!

tunic’s picture

Oops, I didn't notice I removed the library installation instructions.

@6c1, I can reroll the patch if you want.

Anonymous’s picture

Hi @tunic; that would be great. Thanks!

tunic’s picture

Status: Needs work » Needs review
FileSize
1.39 KB

Patched rerrolled, now it just includes the new paragraph.

levelos’s picture

Status: Needs review » Fixed

  • levelos committed 725d01a on 7.x-2.x authored by tunic
    Issue #2361027 by tunic: Add documentation for sending region values to...

Status: Fixed » Closed (fixed)

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

vonFrakas’s picture

Assigned: » Unassigned

Drupal 9:

As mentioned by @marthinal in #3 here, https://www.drupal.org/project/mandrill/issues/2815947#comment-12700364, for D9 it needs to be:

$message['params']['mandrill']['overrides']['mandrill_template_content'][] = [
  'name' => 'foo',
  'content' => 'foo value',
];