function hashtags_nodeapi in Hashtags 6
Same name and namespace in other branches
- 6.2 hashtags.module \hashtags_nodeapi()
Implementation of hook_nodeapi().
File
- ./
hashtags.module, line 39
Code
function hashtags_nodeapi(&$node, $op, $teaser, $page) {
$vid = variable_get('hashtags_vocabulary', '');
$voc = taxonomy_vocabulary_load($vid);
if (!in_array($node->type, $voc->nodes)) {
return;
}
switch ($op) {
case 'presave':
$vid = variable_get('hashtags_vocabulary', '');
// Parse body to get all hashtags (#some_word) and pass as commas separated string.
$hashtags_string = hashtags_get_tags($node->body);
$node->taxonomy['tags'][$vid] = $hashtags_string;
break;
}
}