You are here

function views_handler_field_node_field::render in Views node field 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

./views_handler_field_node_field.inc, line 62

Class

views_handler_field_node_field
Field handler to present a node.

Code

function render($values) {
  if ($values->{$this->aliases['nid']} && ($node = node_load($values->{$this->aliases['nid']}))) {
    $node->view = $this->view;
    $options = $this->options;

    // Detect which build module should be used.
    $node->build_mode = !empty($options['build_mode']) ? $options['build_mode'] : 'full';
    $content = node_view($node, $node->build_mode);
    if (!$options['links']) {
      unset($content['links']);
    }
    if (!empty($options['comments']) && user_access('access comments') && $node->comment) {
      $content['comments'] = comment_node_page_additions($node);
    }
    return drupal_render($content);
  }
  return array();
}