I would like to create a custom module that include the following database field type:
* single-line textfield (OK)
* multi-line textfield
* checkbox
* list selection
* freeform list
* URL
* date
How can I modify the example module to include these fields?
Maybe we can create documentation for an advanced example node type!
Thanks, Darly
-------------------
The example module is documentated as follows:
Database definition:
CREATE TABLE node_example ( nid int(10) unsigned NOT NULL default '0', color varchar(255) NOT NULL default '', quantity int(10) unsigned NOT NULL default '0', PRIMARY KEY (nid) )
Implementation of hook_form().
Now it's time to describe the form for collecting the information specific to this node type. This hook requires us to return an array with a sub array containing information for each element in the form.
Code
function node_example_form(&$node) {
$form['title'] = array('#type' => 'textfield', '#title' => t('Title'),
'#size' => 60, '#maxlength' => 128, '#required' => TRUE,
'#default_value' => $node->title);
$form['body'] = array('#type' => 'textarea', '#title' => t('Body'),
'#default_value' => $node->body, '#required' => FALSE );
// Now we define the form elements specific to our node type.
$form['color'] = array('#type' => 'textfield', '#title' => t('Color'),