You are here

function template_preprocess_views_view_row_node in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 modules/node.views.inc \template_preprocess_views_view_row_node()

Template helper for theme_views_view_row_node

Related topics

File

modules/node.views.inc, line 836
Provide views data and handlers for node.module

Code

function template_preprocess_views_view_row_node(&$vars) {
  $options = $vars['options'];

  // Make sure the variables are defined.
  $vars['node'] = '';
  $vars['comments'] = '';
  if (!empty($vars['row']->{$vars['field_alias']})) {
    $nid = $vars['row']->{$vars['field_alias']};
  }
  if (!is_numeric($nid)) {
    return;
  }
  $node = node_load($nid);
  if (empty($node)) {
    return;
  }
  $node->view = $vars['view'];
  $node->build_mode = $options['build_mode'] == 'teaser' || $options['build_mode'] == 'full' ? NODE_BUILD_NORMAL : $options['build_mode'];
  $vars['node'] = node_view($node, $options['build_mode'] == 'teaser', FALSE, $options['links']);
  if (!empty($options['comments']) && function_exists('comment_render')) {
    $vars['comments'] = comment_render($node);
  }
}