1 views_handler_field_comment_link.inc views_handler_field_comment_link::render_link($data, $values)

File

core/modules/comment/views/views_handler_field_comment_link.inc, line 48
Definition of views_handler_field_comment_link.

Class

views_handler_field_comment_link
Base field handler to present a link.

Code

function render_link($data, $values) {
  $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
  $comment = $this->get_value($values);
  $nid = $comment->nid;
  $cid = $comment->cid;

  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['html'] = TRUE;

  if (!empty($cid)) {
    $this->options['alter']['path'] = "comment/" . $cid;
    $this->options['alter']['fragment'] = "comment-" . $cid;
  }
  // If there is no comment link to the node.
  elseif ($this->options['link_to_node']) {
    $this->options['alter']['path'] = "node/" . $nid;
  }

  return $text;
}