function views_handler_field_comment_link::render_link

3.x views_handler_field_comment_link.inc views_handler_field_comment_link::render_link($data, $values)
2 calls to views_handler_field_comment_link::render_link()

File

modules/comment/views_handler_field_comment_link.inc, line 49
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.
  else if ($this->options['link_to_node']) {
    $this->options['alter']['path'] = "node/" . $nid;
  }

  return $text;
}