You are here

function NodeLink::render in Views (for Drupal 7) 8.3

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides FieldPluginBase::render

File

lib/Views/comment/Plugin/views/field/NodeLink.php, line 44
Definition of Views\comment\Plugin\views\field\NodeLink.

Class

NodeLink
Handler for showing comment module's node link.

Namespace

Views\comment\Plugin\views\field

Code

function render($values) {
  $node = $this
    ->get_entity($values);

  // Call comment.module's hook_link: comment_link($type, $node = NULL, $teaser = FALSE)
  // Call node by reference so that something is changed here
  comment_node_view($node, $this->options['teaser'] ? 'teaser' : 'full');

  // question: should we run these through:    drupal_alter('link', $links, $node);
  // might this have unexpected consequences if these hooks expect items in $node that we don't have?
  // Only render the links, if they are defined.
  return !empty($node->content['links']['comment']) ? drupal_render($node->content['links']['comment']) : '';
}