views_handler_field_node_link_delete.inc

  1. 3.x modules/node/views_handler_field_node_link_delete.inc
  2. 2.x modules/node/views_handler_field_node_link_delete.inc

Definition of views_handler_field_node_link_delete.

File

modules/node/views_handler_field_node_link_delete.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_field_node_link_delete.
  5. */
  6. /**
  7. * Field handler to present a link to delete a node.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class views_handler_field_node_link_delete extends views_handler_field_node_link {
  12. /**
  13. * Renders the link.
  14. */
  15. function render_link($node, $values) {
  16. // Ensure user has access to delete this node.
  17. if (!node_access('delete', $node)) {
  18. return;
  19. }
  20. $this->options['alter']['make_link'] = TRUE;
  21. $this->options['alter']['path'] = "node/$node->nid/delete";
  22. $this->options['alter']['query'] = drupal_get_destination();
  23. $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
  24. return $text;
  25. }
  26. }