You are here

function vud_comment_handler_field_widget::render in Vote Up/Down 6.3

Same name and namespace in other branches
  1. 6.2 vud_comment/views/vud_comment_handler_field_widget.inc \vud_comment_handler_field_widget::render()
  2. 7 vud_comment/views/vud_comment_handler_field_widget.inc \vud_comment_handler_field_widget::render()

File

vud_comment/views/vud_comment_handler_field_widget.inc, line 33
Provide a handler for Vote Up/down widget field for comments.

Class

vud_comment_handler_field_widget
A handler that provides a Vote Up/Down widget field for nodes.

Code

function render($values) {
  $widget = '';
  $cid = $values->{$this->aliases['cid']};
  $query = 'SELECT n.type FROM {comments} c LEFT JOIN {node} n ON c.nid = n.nid WHERE c.cid = %d';
  $type = db_result(db_query($query, $cid));
  $comment_allow = in_array($type, variable_get('vud_comment_node_types', array()), TRUE);
  if ($comment_allow && user_access('use vote up/down on comments')) {
    $tag = variable_get('vud_tag', 'vote');
    $widget_type = variable_get('vud_comment_widget', 'plain');
    $widget = theme('vud_widget', $cid, 'comment', $tag, $widget_type);
  }
  return $widget;
}