function plus1_nodeapi in Plus 1 6
Same name and namespace in other branches
- 6.2 plus1.module \plus1_nodeapi()
Implementation of hook_nodeapi().
File
- ./
plus1.module, line 204 - A simple +1 voting widget module.
Code
function plus1_nodeapi(&$node, $op, $teaser, $page) {
switch ($op) {
case 'view':
// Only show the voting widget in allowed content types.
if (in_array($node->type, variable_get('plus1_nodetypes', array(
'story',
)))) {
// Show the widget.
if ($teaser && variable_get('plus1_in_teaser', 0) || !$teaser && variable_get('plus1_in_full_view', 1)) {
$node->content['plus1_widget'] = array(
'#value' => plus1_jquery_widget($node->nid, $teaser),
'#weight' => 100,
);
}
}
break;
case 'delete':
db_query('DELETE FROM {plus1_vote} WHERE nid = %d', $node->nid);
break;
}
}