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