function template_preprocess_views_view_row_comment

Template helper for theme_views_view_row_comment.

File

modules/comment.views.inc, line 694

Code

function template_preprocess_views_view_row_comment(&$vars) {
    $options = $vars['options'];
    $view =& $vars['view'];
    $plugin =& $view->style_plugin->row_plugin;
    $comment = $plugin->comments[$vars['row']->{$vars['field_alias']}];
    $node = $plugin->nodes[$comment->nid];
    // Put the view on the node so we can retrieve it in the preprocess.
    $node->view =& $view;
    $build = comment_view_multiple(array(
        $comment->cid => $comment,
    ), $node, $plugin->options['view_mode']);
    // If displaying the comments without links, remove them from the renderable
    // array; there is no way to avoid building them in the first place.
    // @see comment_build_content()
    if (empty($options['links'])) {
        foreach ($build as &$comment_build) {
            if (isset($comment_build['links'])) {
                unset($comment_build['links']);
            }
        }
        unset($comment_build);
    }
    $vars['comment'] = drupal_render($build);
}