You are here

function views_handler_field_comment_node_link::render in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 modules/comment/views_handler_field_comment_node_link.inc \views_handler_field_comment_node_link::render()
  2. 7.3 modules/comment/views_handler_field_comment_node_link.inc \views_handler_field_comment_node_link::render()

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides views_handler_field::render

File

modules/comment/views_handler_field_comment_node_link.inc, line 46

Class

views_handler_field_comment_node_link
Handler for showing comment module's node link.

Code

function render($values) {

  // Build fake $node.
  $node = new stdClass();
  $node->nid = $this
    ->get_value($values, 'nid');
  $node->type = $this
    ->get_value($values, 'type');
  $node->comment = $this
    ->get_value($values, 'comment');

  // Call comment.module's hook_link: comment_link($type, $node = NULL, $teaser = FALSE)
  $links = comment_link('node', $node, $this->options['teaser']);

  // question: should we run these through:    drupal_alter('link', $links, $node);
  // might this have unexpected consequences if these hooks expect items in $node that we don't have?
  return !empty($links) ? theme('links', $links, array(
    'class' => 'links inline',
  )) : '';
}