You are here

feedapi_handler_field_node_link_purge.inc in FeedAPI 6

File

views/handlers/feedapi_handler_field_node_link_purge.inc
View source
<?php

/**
 * Field handler to present a purge node link.
 */
class feedapi_handler_field_node_link_purge extends views_handler_field_node_link {
  function construct() {
    parent::construct();
    $this->additional_fields['nid'] = 'nid';
    $this->additional_fields['uid'] = array(
      'table' => 'node',
      'field' => 'uid',
    );
    $this->additional_fields['type'] = array(
      'table' => 'node',
      'field' => 'type',
    );
  }
  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->status = 1;

    // unpublished nodes ignore access control
    if (!_feedapi_op_access($node)) {
      return;
    }
    $text = !empty($this->options['text']) ? $this->options['text'] : t('purge');
    return l($text, "node/{$node->nid}/purge", array(
      'query' => drupal_get_destination(),
    ));
  }

}

Classes

Namesort descending Description
feedapi_handler_field_node_link_purge Field handler to present a purge node link.