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

Overrides views_handler_field_node_revision_link::render_link

File

core/modules/node/views/views_handler_field_node_revision_link_delete.inc, line 19
Definition of views_handler_field_node_revision_link_delete.

Class

views_handler_field_node_revision_link_delete
Field handler to present link to delete a node revision.

Code

function render_link($data, $values) {
  list($node, $vid) = $this->get_revision_entity($values, 'delete');
  if (!isset($vid)) {
    return;
  }

  // Current revision cannot be deleted.
  if ($node->vid == $vid) {
    return;
  }

  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['path'] = 'node/' . $node->nid . "/revisions/$vid/delete";
  $this->options['alter']['query'] = backdrop_get_destination();

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