function notifications_content_token_values in Notifications 6.4
Same name and namespace in other branches
- 5 notifications_content/notifications_content.module \notifications_content_token_values()
- 6 notifications_content/notifications_content.module \notifications_content_token_values()
- 6.2 notifications_content/notifications_content.module \notifications_content_token_values()
- 6.3 notifications_content/notifications_content.module \notifications_content_token_values()
Implementation of hook_token_values()
File
- notifications_content/
notifications_content.module, line 925 - Subscriptions to content events
Code
function notifications_content_token_values($type, $object = NULL, $options = array()) {
switch ($type) {
case 'node':
if (is_object($object) && ($node = drupal_clone($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-teaser-raw'] = !empty($node->teaser) ? $node->teaser : '';
$values['node-body-raw'] = !empty($node->body) ? $node->body : '';
// Fully rendered node content
$node = node_build_content($node);
$values['node-content'] = drupal_render($node->content);
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;
}
}