You are here

function Comment::render_link in Views (for Drupal 7) 8.3

1 call to Comment::render_link()
Comment::render in lib/Views/comment/Plugin/views/field/Comment.php
Render the field.

File

lib/Views/comment/Plugin/views/field/Comment.php, line 63
Definition of Views\comment\Plugin\views\field\Comment.

Class

Comment
Field handler to allow linking to a comment.

Namespace

Views\comment\Plugin\views\field

Code

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;
}