function Revision::render_link in Views (for Drupal 7) 8.3
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
- lib/
Views/ node/ Plugin/ views/ field/ Revision.php, line 60 - Definition of Views\node\Plugin\views\field\Revision.
Class
- Revision
- A basic node_revision handler.
Namespace
Views\node\Plugin\views\fieldCode
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 . '/revisions/' . $vid . '/view';
if (module_exists('translation')) {
$langcode = $this
->get_value($values, 'langcode');
$languages = language_list();
if (isset($languages[$langcode])) {
$this->options['alter']['langcode'] = $languages[$langcode];
}
}
}
else {
return parent::render_link($data, $values);
}
return $data;
}