function Revision::render_link

Render whatever the data is as a link to the node.

Data should be made XSS safe prior to calling this function.

Overrides Node::render_link

File

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

Class

Revision
A basic node_revision handler.

Namespace

Drupal\node\Plugin\views\field

Code

function render_link($data, $values) {
  if (!empty($this->options['link_to_node_revision']) && $data !== NULL && $data !== '') {
    $this->options['alter']['make_link'] = TRUE;
    $nid = $this
      ->getValue($values, 'nid');
    $vid = $this
      ->getValue($values, 'vid');
    $this->options['alter']['path'] = "node/" . $nid . '/revisions/' . $vid . '/view';
    if (module_exists('translation')) {
      $langcode = $this
        ->getValue($values, 'langcode');
      $languages = language_list();
      if (isset($languages[$langcode])) {
        $this->options['alter']['langcode'] = $languages[$langcode];
      }
    }
  }
  else {
    return parent::render_link($data, $values);
  }
  return $data;
}