You are here

public function views_handler_field_comment::render_link in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 modules/comment/views_handler_field_comment.inc \views_handler_field_comment::render_link()
  2. 6.2 modules/comment/views_handler_field_comment.inc \views_handler_field_comment::render_link()
1 call to views_handler_field_comment::render_link()
views_handler_field_comment::render in modules/comment/views_handler_field_comment.inc
Render the field.

File

modules/comment/views_handler_field_comment.inc, line 58
Definition of views_handler_field_comment.

Class

views_handler_field_comment
Field handler to allow linking to a comment.

Code

public function render_link($data, $values) {
  if (!empty($this->options['link_to_comment'])) {
    $this->options['alter']['make_link'] = TRUE;
    $nid = $this
      ->get_value($values, 'nid');
    $cid = $this
      ->get_value($values, 'cid');
    if (!empty($cid)) {
      $this->options['alter']['path'] = "comment/" . $cid;
      $this->options['alter']['fragment'] = "comment-" . $cid;
    }
    elseif ($this->options['link_to_node']) {
      $this->options['alter']['path'] = "node/" . $nid;
    }
  }
  return $data;
}