You are here

function notifications_content_token_values in Notifications 5

Same name and namespace in other branches
  1. 6.4 notifications_content/notifications_content.module \notifications_content_token_values()
  2. 6 notifications_content/notifications_content.module \notifications_content_token_values()
  3. 6.2 notifications_content/notifications_content.module \notifications_content_token_values()
  4. 6.3 notifications_content/notifications_content.module \notifications_content_token_values()

Implementation of hook_token_values()

File

notifications_content/notifications_content.module, line 746
Subscriptions to content events

Code

function notifications_content_token_values($type, $object = NULL, $options = array()) {
  switch ($type) {
    case 'node':
      if ($node = $object) {
        $values['node-teaser'] = $node->teaser ? check_markup($node->teaser, $node->format, FALSE) : '';
        $values['node-body'] = $node->body ? check_markup($node->body, $node->format, FALSE) : '';
        $values['node-url'] = url('node/' . $node->nid, NULL, NULL, TRUE);
        $values['node-teaser-raw'] = $node->teaser ? $node->teaser : '';
        $values['node-body-raw'] = $node->body ? $node->body : '';
        return $values;
      }
      break;
    case 'comment':
      if ($comment = (object) $object) {
        $values['comment-url'] = url('node/' . $comment->nid, NULL, 'comment-' . $comment->cid, TRUE);
        $values['comment-reply-url'] = url('comment/reply/' . $comment->nid . '/' . $comment->cid, NULL, NULL, TRUE);
        return $values;
      }
      break;
  }
}