You are here

webform_handler_field_form_body.inc in Webform 6.3

Views handler to display the content of a webform form.

File

views/webform_handler_field_form_body.inc
View source
<?php

/**
 * @file
 * Views handler to display the content of a webform form.
 */

/**
 * Field handler to present the Webform form body to the user.
 */
class webform_handler_field_form_body extends views_handler_field {
  function construct() {
    parent::construct();
    $this->additional_fields['nid'] = 'nid';
  }
  function option_definition() {
    $options = parent::option_definition();
    $options['label'] = array(
      'default' => 'Form',
      'translatable' => TRUE,
    );
    return $options;
  }
  function query() {
    $this
      ->ensure_my_table();
    $this
      ->add_additional_fields();
  }
  function render($values) {
    $node = node_load($values->{$this->aliases['nid']});
    if (node_access('view', $node)) {

      // Populate $node->content['webform'] by reference.
      webform_node_view($node, FALSE, FALSE);
      $form_body = isset($node->content['webform']['#value']) ? $node->content['webform']['#value'] : NULL;
    }
    else {
      return;
    }
    return $form_body;
  }

}

Classes

Namesort descending Description
webform_handler_field_form_body Field handler to present the Webform form body to the user.