function discussthis_token_values in Discuss This! 6
Same name and namespace in other branches
- 5 discussthis.module \discussthis_token_values()
\brief Implementation of hook_token_values()
This function provides the values for discussthis tokens.
\note We expect the forum to have a filter validating the node contents that we provide in the tokens. Because of this, we do not tweak the data at all (except for the <!--break--> which gets removed from the body.)
\param[in] $type the context/type of object \param[in] $object the object itself \param[in] $options the options, context and object-sensitive
\return array of token values keyed by their name
File
- ./
discussthis.module, line 676 - Associations discussions in forums with specific nodes
Code
function discussthis_token_values($type, $object = NULL, $options = array()) {
if ($type == 'discussthis' && $object) {
$object->body = str_replace('<!--break-->', '', $object->body);
$tokens['node-link'] = l($object->title, 'node/' . $object->nid);
$tokens['node-title'] = $object->title;
$tokens['node-type-name'] = node_get_types('name', $object);
$tokens['node-type'] = $object->type;
$tokens['node-teaser'] = $object->teaser;
$tokens['node-body'] = $object->body;
$tokens['node-body-50'] = substr($object->body, 0, 50);
$tokens['node-body-100'] = substr($object->body, 0, 100);
$tokens['node-body-200'] = substr($object->body, 0, 200);
$tokens['node-body-400'] = substr($object->body, 0, 400);
return $tokens;
}
}