function fivestar_block in Fivestar 6
Same name and namespace in other branches
- 5 fivestar.module \fivestar_block()
- 6.2 fivestar.module \fivestar_block()
File
- ./
fivestar.module, line 983 - A simple n-star voting widget, usable in other forms.
Code
function fivestar_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Fivestar: Rate this node');
return $blocks;
case 'view':
if (user_access('access content') && user_access('rate content')) {
if (arg(0) == 'node' && is_numeric(arg(1)) && (arg(2) == '' || arg(2) == 'view')) {
$node = node_load(arg(1));
if (fivestar_validate_target('node', $node->nid)) {
$block['subject'] = t('Rate This');
$block['content'] = fivestar_widget_form($node);
return $block;
}
}
}
break;
}
}