[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/webform/views/ -> webform_handler_field_form_body.inc (source)

   1  <?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        webform_node_view($node, FALSE, FALSE);
  34        $form_body = isset($node->content['webform']['#value']) ? $node->content['webform']['#value'] : NULL;
  35      }
  36      else {
  37        return;
  38      }
  39  
  40      return $form_body;
  41    }
  42  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7