1 views_handler_field_comment.inc | views_handler_field_comment::render_link($data, $values) |
File
- core/
modules/ comment/ views/ views_handler_field_comment.inc, line 50 - Definition of views_handler_field_comment.
Class
- views_handler_field_comment
- Field handler to allow linking to a comment.
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;
}
// If there is no comment link to the node.
elseif ($this->options['link_to_node']) {
$this->options['alter']['path'] = "node/" . $nid;
}
}
return $data;
}