function Link::render_link

Same name in this branch
  1. 9.x drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php \Drupal\node\Plugin\views\field\Link::render_link()
  2. 9.x drupal/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.php \Drupal\user\Plugin\views\field\Link::render_link()
  3. 9.x drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php \Drupal\comment\Plugin\views\field\Link::render_link()
2 calls to Link::render_link()
Link::render in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php
Render the field.
LinkEdit::render_link in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php
4 methods override Link::render_link()
LinkApprove::render_link in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php
LinkDelete::render_link in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php
LinkEdit::render_link in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php
LinkReply::render_link in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php

File

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

Class

Link
Base field handler to present a link.

Namespace

Drupal\comment\Plugin\views\field

Code

function render_link($data, $values) {
  $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
  $comment = $data;
  $nid = $comment->nid;
  $cid = $comment
    ->id();
  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['html'] = TRUE;
  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 $text;
}