function workflow_notify_mail in Workflow 7.2
Same name and namespace in other branches
- 7 workflow_notify/workflow_notify.module \workflow_notify_mail()
Implements hook_mail(); Build email messages.
File
- workflow_notify/
workflow_notify.module, line 178 - Notify roles for Workflow state transitions.
Code
function workflow_notify_mail($key, &$message, $params) {
switch ($key) {
case 'workflow_notify':
$filter = $params['filter'];
$message['send'] = TRUE;
$entity_type = $params['data']['entity_type'];
$entity = isset($params['data']['entity']) ? $params['data']['entity'] : $params['data']['node'];
$entity_uri = entity_uri($entity_type, $entity);
list($entity_id, , $entity_bundle) = entity_extract_ids($entity_type, $entity);
$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'), $entity_uri['path']));
return;
}
}