1 views_handler_field_node_revision_link.inc views_handler_field_node_revision_link::render_link($data, $values)

Overrides views_handler_field_node_link::render_link

File

core/modules/node/views/views_handler_field_node_revision_link.inc, line 23
Definition of views_handler_field_node_revision_link.

Class

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

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'] = backdrop_get_destination();

  return !empty($this->options['text']) ? $this->options['text'] : t('view');
}