Book Image

Drupal 7 Webform Cookbook

By : Vernon Denny
Book Image

Drupal 7 Webform Cookbook

By: Vernon Denny

Overview of this book

<p>The Drupal Content Management System puts everyone in charge of their own internet destiny. Webform takes this power a step further by ensuring that you are never more than just a few mouse-clicks away from fully functional information-gathering forms. From simple contact forms to advanced web applications, Webform provides a solid tool set for both the novice and the expert.<br /><br /><em>Drupal 7 Webform Cookbook</em> gives you everything you need to achieve in minutes what previously cost hours in development and testing. Practical demonstrations of every facet give both the technical and the not-so-technical users an in-depth understanding of how things work.<br /><br />Install. Use. Customize. Extend. A mammoth learning curve devoured in small bytes: all digestible, with no choking.<br /><br />From designing coherent forms, to sending pretty HTML emails and managing data, explore the rich scope of possibilities that Webform enables. Also, easily extend and tune Webform with custom components and functionality.<br /><br />With <em>Drupal 7 Webform Cookbook</em> you are placed firmly in the driving seat.</p>
Table of Contents (18 chapters)
Drupal 7 Webform Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Defining component features


Our first step towards defining our component to Webform is hook_webform_component_info(). In this hook we give our component a name, a description, and a list of Webform features we would like to enable or disable.

Getting ready

Using our favorite text editor, let's open our module file for editing so that we may start the process of defining our new Webform component.

How to do it...

When we utilize a hook we must be careful to rename the function according to our module name. With that in mind, let's add the following code to the new webform_imei.module file we created previously:

/**
* Implements hook_webform_component_info().
*/
function webform_imei_webform_component_info() {
$components = array();
$components['imei'] = array(
'label' => t('IMEI'),
'description' => t('IMEI number type.'),
'features' => array(
'csv' => TRUE,
'email' => TRUE,
'email_address' => FALSE,
'email_name' => FALSE,
'required' => TRUE,
'conditional' => TRUE...