You are here

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

Same name in this branch
  1. 8.3 lib/Views/node/Plugin/views/field/LinkDelete.php \Views\node\Plugin\views\field\LinkDelete::render_link()
  2. 8.3 lib/Views/comment/Plugin/views/field/LinkDelete.php \Views\comment\Plugin\views\field\LinkDelete::render_link()

Renders the link.

Overrides Link::render_link

File

lib/Views/node/Plugin/views/field/LinkDelete.php, line 28
Definition of Views\node\Plugin\views\field\LinkDelete.

Class

LinkDelete
Field handler to present a link to delete a node.

Namespace

Views\node\Plugin\views\field

Code

function render_link($node, $values) {

  // Ensure user has access to delete this node.
  if (!node_access('delete', $node)) {
    return;
  }
  $this->options['alter']['make_link'] = TRUE;
  $this->options['alter']['path'] = "node/{$node->nid}/delete";
  $this->options['alter']['query'] = drupal_get_destination();
  $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
  return $text;
}