You are here

function notifications_content_token_values in Notifications 6.3

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

Implementation of hook_token_values()

File

notifications_content/notifications_content.module, line 882
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'] = !empty($node->teaser) ? check_markup($node->teaser, $node->format, FALSE) : '';
        $values['node-body'] = !empty($node->body) ? check_markup($node->body, $node->format, FALSE) : '';
        $values['node-url'] = url('node/' . $node->nid, array(
          'absolute' => TRUE,
        ));
        $values['node-teaser-raw'] = !empty($node->teaser) ? $node->teaser : '';
        $values['node-body-raw'] = !empty($node->body) ? $node->body : '';
        return $values;
      }
      break;
    case 'comment':
      if ($comment = (object) $object) {
        $values['comment-url'] = url('node/' . $comment->nid, array(
          'fragment' => 'comment-' . $comment->cid,
          'absolute' => TRUE,
        ));
        $values['comment-reply-url'] = url('comment/reply/' . $comment->nid . '/' . $comment->cid, array(
          'absolute' => TRUE,
        ));
        return $values;
      }
      break;
  }
}