You are here

function mail_logger_token_values in Mail Logger 6

Same name and namespace in other branches
  1. 7 mail_logger.module \mail_logger_token_values()

Implementation of hook_token_values().

File

./mail_logger.module, line 331
Mail Logger module logs all outgoing mail that passes through the drupal_mail function.

Code

function mail_logger_token_values($type, $object = NULL) {
  $values = array();
  switch ($type) {
    case 'mail':
      $object = (array) $object;
      $values['mlid'] = $object['id'];
      $values['mailkey'] = check_plain($object['mailkey']);
      $values['to'] = check_plain($object['to']);
      $values['to-raw'] = $object['to'];
      $values['subject'] = check_plain($object['subject']);
      $values['subject-raw'] = $object['subject'];
      $values['body'] = check_markup($object['body']);
      $values['body-raw'] = $object['body'];
      $values['from'] = check_plain($object['from']);
      $values['from-raw'] = $object['from'];
      $values['date'] = format_date($object['date_sent']);
      $values['language'] = is_object($object['language']) ? $object['language']->language : $object['language'];
      break;
  }
  return $values;
}