views_handler_field_node_link_export.inc 845 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @file
  4. * The Node export views field handler.
  5. */
  6. /**
  7. * Field handler to present a export node link.
  8. *
  9. * Closely modeled after views/modules/node/views_handler_field_node_link_edit.inc
  10. */
  11. class views_handler_field_node_link_export extends views_handler_field_node_link {
  12. function construct() {
  13. parent::construct();
  14. $this->additional_fields['nid'] = 'nid';
  15. }
  16. function render($values) {
  17. // Ensure that user has access to export this node.
  18. $node = new stdClass();
  19. $node->nid = $values->{$this->aliases['nid']};
  20. if (!node_export_access_export($node->nid)) {
  21. return;
  22. }
  23. $text = !empty($this->options['text']) ? $this->options['text'] : t('Node export');
  24. return l($text, "node/$node->nid/node_export", array('query' => drupal_get_destination()));
  25. }
  26. }