1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Views handler to display the content of a webform form.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Field handler to present the Webform form body to the user.
|
10 |
|
|
*/
|
11 |
|
|
class webform_handler_field_form_body extends views_handler_field {
|
12 |
|
|
function construct() {
|
13 |
|
|
parent::construct();
|
14 |
|
|
$this->additional_fields['nid'] = 'nid';
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
function option_definition() {
|
18 |
|
|
$options = parent::option_definition();
|
19 |
|
|
$options['label'] = array('default' => 'Form', 'translatable' => TRUE);
|
20 |
|
|
return $options;
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
function query() {
|
24 |
|
|
$this->ensure_my_table();
|
25 |
|
|
$this->add_additional_fields();
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
function render($values) {
|
29 |
|
|
$node = node_load($values->{$this->aliases['nid']});
|
30 |
|
|
|
31 |
|
|
if (node_access('view', $node)) {
|
32 |
|
|
// Populate $node->content['webform'] by reference.
|
33 |
e3063c4a
|
Assos Assos
|
webform_node_view($node, 'form');
|
34 |
85ad3d82
|
Assos Assos
|
$form_body = isset($node->content['webform']) ? drupal_render($node->content['webform']) : NULL;
|
35 |
|
|
}
|
36 |
|
|
else {
|
37 |
|
|
return;
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
return $form_body;
|
41 |
|
|
}
|
42 |
|
|
} |