[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/views/modules/node/ -> views_handler_field_node_link_delete.inc (source)

   1  <?php
   2  // $Id: views_handler_field_node_link_delete.inc,v 1.1 2008/09/03 19:21:29 merlinofchaos Exp $
   3  /**
   4   * Field handler to present a link to delete a node.
   5   */
   6  class views_handler_field_node_link_delete extends views_handler_field_node_link {
   7    function construct() {
   8      parent::construct();
   9      $this->additional_fields['type'] = 'type';
  10      $this->additional_fields['uid'] = 'uid';
  11      $this->additional_fields['format'] = array('table' => 'node_revisions', 'field' => 'format');
  12    }
  13  
  14    function render($values) {
  15      // ensure user has access to edit this node.
  16      $node = new stdClass();
  17      $node->nid = $values->{$this->aliases['nid']};
  18      $node->uid = $values->{$this->aliases['uid']};
  19      $node->type = $values->{$this->aliases['type']};
  20      $node->format = $values->{$this->aliases['format']};
  21      $node->status = 1; // unpublished nodes ignore access control
  22      if (!node_access('delete', $node)) {
  23        return;
  24      }
  25  
  26      $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
  27      return l($text, "node/$node->nid/delete", array('query' => drupal_get_destination()));
  28    }
  29  }
  30  


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7