1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_handler_field_node_path.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Field handler to present the path to the node.
|
10
|
*
|
11
|
* @ingroup views_field_handlers
|
12
|
*/
|
13
|
class views_handler_field_node_path extends views_handler_field {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function option_definition() {
|
19
|
$options = parent::option_definition();
|
20
|
$options['absolute'] = array('default' => FALSE, 'bool' => TRUE);
|
21
|
|
22
|
return $options;
|
23
|
}
|
24
|
|
25
|
/**
|
26
|
* {@inheritdoc}
|
27
|
*/
|
28
|
public function construct() {
|
29
|
parent::construct();
|
30
|
$this->additional_fields['nid'] = 'nid';
|
31
|
}
|
32
|
|
33
|
/**
|
34
|
* {@inheritdoc}
|
35
|
*/
|
36
|
public function options_form(&$form, &$form_state) {
|
37
|
parent::options_form($form, $form_state);
|
38
|
$form['absolute'] = array(
|
39
|
'#type' => 'checkbox',
|
40
|
'#title' => t('Use absolute link (begins with "http://")'),
|
41
|
'#default_value' => $this->options['absolute'],
|
42
|
'#description' => t('Enable this option to output an absolute link. Required if you want to use the path as a link destination (as in "output this field as a link" above).'),
|
43
|
'#fieldset' => 'alter',
|
44
|
);
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* {@inheritdoc}
|
49
|
*/
|
50
|
public function query() {
|
51
|
$this->ensure_my_table();
|
52
|
$this->add_additional_fields();
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* {@inheritdoc}
|
57
|
*/
|
58
|
public function render($values) {
|
59
|
$nid = $this->get_value($values, 'nid');
|
60
|
return url("node/$nid", array('absolute' => $this->options['absolute']));
|
61
|
}
|
62
|
|
63
|
}
|