File
- drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Comment.php, line 63
- Definition of Drupal\comment\Plugin\views\field\Comment.
Class
- Comment
- Field handler to allow linking to a comment.
Namespace
Drupal\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;
}