function vud_node_handler_field_widget::render in Vote Up/Down 6.3
Same name and namespace in other branches
- 6.2 vud_node/views/vud_node_handler_field_widget.inc \vud_node_handler_field_widget::render()
- 7 vud_node/views/vud_node_handler_field_widget.inc \vud_node_handler_field_widget::render()
File
- vud_node/
views/ vud_node_handler_field_widget.inc, line 33 - Provide a handler for Vote Up/down widget field for nodes.
Class
- vud_node_handler_field_widget
- A handler that provides a Vote Up/Down widget field for nodes.
Code
function render($values) {
$widget = '';
if (($can_edit = user_access('use vote up/down on nodes')) || user_access('view vote up/down count on nodes')) {
$nid = $values->{$this->aliases['nid']};
$type = db_result(db_query(db_rewrite_sql('SELECT type FROM {node} n WHERE n.nid = %d'), $nid));
$valid_type = in_array($type, variable_get('vud_node_types', array()), TRUE);
if ($valid_type) {
$tag = variable_get('vud_tag', 'vote');
$widget_type = variable_get('vud_node_widget', 'plain');
drupal_alter('vud_node_widget', $widget, $nid);
$widget_message_code = !$can_edit ? VUD_WIDGET_MESSAGE_DENIED : VUD_WIDGET_MESSAGE_ERROR;
$widget = theme('vud_widget', $nid, 'node', $tag, $widget_type, !$can_edit, $widget_message_code);
}
}
return $widget;
}