You are here

function heartbeat_comments_token_values in Heartbeat 6.4

Implementation of hook_token_values().

File

modules/heartbeat_comments/heartbeat_comments.module, line 359
heartbeat_comments.module Heartbeat comments can come with two possible

Code

function heartbeat_comments_token_values($type, $object = NULL, $options = array()) {
  $values = array();
  switch ($type) {
    case 'heartbeat_comment':
      $comment = (object) $object;
      $values['heartbeat-comment-id'] = isset($comment->nid) ? $comment->cid : $comment->hcid;
      $values['heartbeat-comment-body'] = check_markup($comment->comment);
      $values['heartbeat-comment-body-raw'] = $comment->comment;
      $values['heartbeat-comment-author-uid'] = $comment->uid;
      $values['heartbeat-comment-date'] = isset($comment->nid) ? format_date($comment->timestamp, 'small') : $comment->time;
      $activity = heartbeat_load_message_instance($comment->uaid);
      $values['heartbeat-comment-uaid'] = $comment->uaid;
      $values['heartbeat-message'] = check_plain($activity->message);
      $values['heartbeat-message-raw'] = $activity->message;
      $values['heartbeat-message-url'] = url('heartbeat/message/' . $activity->uaid, array(
        'absolute' => TRUE,
      ));
      $values['heartbeat-message-link'] = l(_theme_time_ago($activity->timestamp), 'heartbeat/message/' . $activity->uaid, array(
        'html' => TRUE,
      ));
      break;
  }
  return $values;
}