function vud_comment_comment_view in Vote Up/Down 7
Implementation of hook_comment_view().
File
- vud_comment/
vud_comment.module, line 115 - Adds a voting widget to comments.
Code
function vud_comment_comment_view($comment, $view_mode, $langcode) {
if (!isset($comment->cid)) {
return;
}
$type = _vud_comment_get_node_type($comment->nid);
$comment_allow = in_array($type, variable_get('vud_comment_node_types', array()), TRUE);
$can_edit = user_access('use vote up/down on comments');
if ($comment_allow && ($can_edit || user_access('view vote up/down count on comments'))) {
$tag = variable_get('vud_tag', 'vote');
$widget_theme = variable_get('vud_comment_widget', 'plain');
$variables = array(
'entity_id' => $comment->cid,
'type' => 'comment',
'tag' => $tag,
'widget_theme' => $widget_theme,
'readonly' => !$can_edit,
);
$comment->vud_comment_widget = theme('vud_widget', $variables);
if (variable_get('vud_comment_widget_display', VUD_COMMENT_DISPLAY_NORMAL) == VUD_COMMENT_DISPLAY_NORMAL) {
// TODO: Pass ta renderable array.
$comment->content['vud_comment_widget'] = array(
'#markup' => $comment->vud_comment_widget,
);
}
}
}