You are here

function messaging_token_values in Messaging 6

Same name and namespace in other branches
  1. 6.4 messaging.module \messaging_token_values()
  2. 6.2 messaging.module \messaging_token_values()
  3. 6.3 messaging.module \messaging_token_values()

Implementation of hook_token_values()

File

./messaging.module, line 956

Code

function messaging_token_values($type, $object = NULL, $options = array()) {
  switch ($type) {
    case 'message':
      if ($message = $object) {
        $values['message-subject'] = check_plain($message->subject);
        $values['message-body'] = filter_xss($message->body);
        $sender = messaging_load_user($message->sender);
        $values['message-author-name'] = check_plain($sender->name);
        $tokens['message-method'] = messaging_method_info($message->method, 'name');
        $tokens['message-date'] = format_date($message->sent);
        return $values;
      }
      break;
  }
}