home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (webform_handler_field_form_body.inc)

This example Drupal source code file (webform_handler_field_form_body.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

extends, false, form_body, function, node, node_view, options, parent::construct, php, render, return, translatable, true, values

The webform_handler_field_form_body.inc Drupal example source code

<?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)) {
      $form_body = node_view($node, FALSE, FALSE);
    }
    else {
      return;
    }

    return $form_body;
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal webform_handler_field_form_body.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.