1 comment.views.inc template_preprocess_views_view_row_comment(&$variables)

Template helper for theme_views_view_row_comment

File

core/modules/comment/views/comment.views.inc, line 702
Provide views data and handlers for comment.module.

Code

function template_preprocess_views_view_row_comment(&$variables) {
  $options = $variables['options'];
  $view = &$variables['view'];
  $plugin = &$view->style_plugin->row_plugin;
  $comment = $plugin->comments[$variables['row']->{$variables['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 we're 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 $cid => &$comment_build) {
      if (isset($comment_build['links'])) {
        unset($comment_build['links']);
      }
    }
  }
  $variables['comment'] = backdrop_render($build);
}