maillog_handler_field_maillog_link_delete.inc 743 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Handler for providing an 'Delete link' in views
  5. */
  6. class maillog_handler_field_maillog_link_delete extends views_handler_field {
  7. function construct() {
  8. parent::construct();
  9. $this->additional_fields['idmaillog'] = 'idmaillog';
  10. }
  11. /**
  12. * Called to add the field to a query.
  13. */
  14. function query() {
  15. $this->ensure_my_table();
  16. $this->add_additional_fields();
  17. }
  18. function render($values) {
  19. // ensure user has access to edit this node.
  20. if (!user_access('delete maillog')) {
  21. return;
  22. }
  23. $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
  24. return l($text, "maillog/delete/$values->idmaillog", array('query' => drupal_get_destination()));
  25. }
  26. }