function discussthis_token_values in Discuss This! 5
Same name and namespace in other branches
- 6 discussthis.module \discussthis_token_values()
Implementation of hook_token_values provides the values for discussthis tokens
Parameters
type the context/type of object:
object the object itself:
options the options, context and object-sensitive:
Return value
array of token values keyed by their name
File
- ./
discussthis.module, line 345
Code
function discussthis_token_values($type, $object = NULL, $options = array()) {
if ($type == 'discussthis') {
$object->body = str_replace('<!--break-->', '', $object->body);
$tokens['node-link'] = l(t($object->title), 'node/' . $object->nid);
$tokens['node-title'] = t($object->title);
$tokens['node-type-name'] = node_get_types('name', $object);
$tokens['node-type'] = $object->type;
$tokens['node-teaser'] = check_plain(preg_replace(array(
'/\\<\\/p\\>/',
'/\\n/',
), ' ', $object->teaser));
$tokens['node-body'] = check_plain(preg_replace(array(
'/\\<\\/p\\>/',
'/\\n/',
), ' ', $object->body));
$tokens['node-body-50'] = substr(check_plain(preg_replace(array(
'/\\<\\/p\\>/',
'/\\n/',
), ' ', $object->body)), 0, 50);
$tokens['node-body-100'] = substr(check_plain(preg_replace(array(
'/\\<\\/p\\>/',
'/\\n/',
), ' ', $object->body)), 0, 100);
$tokens['node-body-200'] = substr(check_plain(preg_replace(array(
'/\\<\\/p\\>/',
'/\\n/',
), ' ', $object->body)), 0, 200);
$tokens['node-body-400'] = substr(check_plain(preg_replace(array(
'/\\<\\/p\\>/',
'/\\n/',
), ' ', $object->body)), 0, 400);
return $tokens;
}
}