You are here

function workflow_notify_mail in Workflow 7

Same name and namespace in other branches
  1. 7.2 workflow_notify/workflow_notify.module \workflow_notify_mail()

Implements hook_mail(); Build email messages.

File

workflow_notify/workflow_notify.module, line 232
Notify roles for Workfllow state transitions.

Code

function workflow_notify_mail($key, &$message, $params) {
  switch ($key) {
    case 'workflow_notify':
      $filter = $params['filter'];
      $message['send'] = TRUE;
      $message['subject'] = filter_xss(token_replace($params['context']['subject'], $params['data'], $params));
      $message['body'][] = check_markup(token_replace($params['context']['body'], $params['data'], $params), $filter);
      watchdog('workflow_notify', '<ul><li>Subject: @subject</li><li>Body: @body</li><li>To: @to</li><li>From: @from</li></ul>', array(
        '@subject' => $message['subject'],
        '@body' => implode('<br />', $message['body']),
        '@to' => $message['to'],
        '@from' => $message['from'],
      ), WATCHDOG_INFO, l(t('view'), 'node/' . $params['data']['node']->nid));
      return;
  }
}