You are here

function RevisionLinkDelete::render_link in Views (for Drupal 7) 8.3

Overrides RevisionLink::render_link

File

lib/Views/node/Plugin/views/field/RevisionLinkDelete.php, line 29
Definition of Views\node\Plugin\views\field\RevisionLinkDelete.

Class

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

Namespace

Views\node\Plugin\views\field

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'] = drupal_get_destination();
  return !empty($this->options['text']) ? $this->options['text'] : t('delete');
}