function RevisionLink::render_link

Overrides Link::render_link

2 methods override RevisionLink::render_link()
RevisionLinkDelete::render_link in drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php
RevisionLinkRevert::render_link in drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php

File

drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php, line 39
Definition of Drupal\node\Plugin\views\field\RevisionLink.

Class

RevisionLink
Field handler to present a link to a node revision.

Namespace

Drupal\node\Plugin\views\field

Code

function render_link($data, $values) {
  list($node, $vid) = $this
    ->get_revision_entity($values, 'view');
  if (!isset($vid)) {
    return;
  }

  // Current revision uses the node view path.
  $path = 'node/' . $node->nid;
  if ($node->vid != $vid) {
    $path .= "/revisions/{$vid}/view";
  }
  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['path'] = $path;
  $this->options['alter']['query'] = drupal_get_destination();
  return !empty($this->options['text']) ? $this->options['text'] : t('view');
}