|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/afglcweb/ny/sites/all/modules/views/modules/node/ |
Upload File : |
<?php
// $Id: views_handler_field_node_link_delete.inc,v 1.1 2008/09/03 19:21:29 merlinofchaos Exp $
/**
* Field handler to present a link to delete a node.
*/
class views_handler_field_node_link_delete extends views_handler_field_node_link {
function construct() {
parent::construct();
$this->additional_fields['type'] = 'type';
$this->additional_fields['uid'] = 'uid';
$this->additional_fields['format'] = array('table' => 'node_revisions', 'field' => 'format');
}
function render($values) {
// ensure user has access to edit this node.
$node = new stdClass();
$node->nid = $values->{$this->aliases['nid']};
$node->uid = $values->{$this->aliases['uid']};
$node->type = $values->{$this->aliases['type']};
$node->format = $values->{$this->aliases['format']};
$node->status = 1; // unpublished nodes ignore access control
if (!node_access('delete', $node)) {
return;
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
return l($text, "node/$node->nid/delete", array('query' => drupal_get_destination()));
}
}