You are here

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

Overrides Link::render_link

2 methods override RevisionLink::render_link()
RevisionLinkDelete::render_link in lib/Views/node/Plugin/views/field/RevisionLinkDelete.php
RevisionLinkRevert::render_link in lib/Views/node/Plugin/views/field/RevisionLinkRevert.php

File

lib/Views/node/Plugin/views/field/RevisionLink.php, line 39
Definition of Views\node\Plugin\views\field\RevisionLink.

Class

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

Namespace

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