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

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

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

Overrides views_handler_field_node::render_link

File

core/modules/node/views/views_handler_field_node_revision.inc, line 52
Definition of views_handler_field_node_revision.

Class

views_handler_field_node_revision
A basic node_revision handler.

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->get_value($values, 'nid');
    $vid = $this->get_value($values, 'vid');
    $this->options['alter']['path'] = 'node/' . $nid;
    if ($nid != $vid) {
      $this->options['alter']['path'] .= "/revisions/$vid/view";
    }
    if (module_exists('translation')) {
      $language = $this->get_value($values, 'langcode');
      $languages = language_list();
      if (isset($languages[$language])) {
        $this->options['alter']['langcode'] = $languages[$language];
      }
    }
  }
  else {
    return parent::render_link($data, $values);
  }
  return $data;
}