function message_example_tokens in Message 7
Same name and namespace in other branches
- 8 modules/message_example/message_example.tokens.inc \message_example_tokens()
Implements hook_tokens().
File
- message_example/
message_example.tokens.inc, line 27 - Token integration for the message example module.
Code
function message_example_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
// Only handeling comment and nodes.
if (!in_array($type, array(
'comment',
'node',
))) {
return;
}
foreach ($tokens as $name => $original) {
// Only hadeling "node/ comment teaser" tokens.
if (!in_array($name, array(
'comment-teaser',
'node-teaser',
))) {
continue;
}
$replacements[$original] = message_example_trim_body($type, $data[$type]);
}
return $replacements;
}