You are here

function Link::render_link in Views (for Drupal 7) 8.3

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

File

lib/Views/comment/Plugin/views/field/Link.php, line 53
Definition of Views\comment\Plugin\views\field\Link.

Class

Link
Base field handler to present a link.

Namespace

Views\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;
}