function NodeNewComments::render_link

1 call to NodeNewComments::render_link()
NodeNewComments::render in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
Render the field.

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php, line 97
Definition of Drupal\comment\Plugin\views\field\NodeNewComments.

Class

NodeNewComments
Field handler to display the number of new comments.

Namespace

Drupal\comment\Plugin\views\field

Code

function render_link($data, $values) {
  if (!empty($this->options['link_to_comment']) && $data !== NULL && $data !== '') {
    $node = entity_create('node', array(
      'nid' => $this
        ->getValue($values, 'nid'),
      'type' => $this
        ->getValue($values, 'type'),
    ));
    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['path'] = 'node/' . $node->nid;
    $this->options['alter']['query'] = comment_new_page_count($this
      ->getValue($values, 'comment_count'), $this
      ->getValue($values), $node);
    $this->options['alter']['fragment'] = 'new';
  }
  return $data;
}