Creating new node types (4.7)

This tutorial is written for Drupal 4.7. There is also a 5.x version of this tutorial.

An alternate to this tutorial on learning how to write modules with new Drupal node types is to copy an existing node module, such as the story module, replace the module name/node type with your new node type, then go through the module and adjust the functionality, as described on How to create your own simple node type (from story node) (Drupal 4.7).

For this tutorial, we're going to make a to-do list module. We want to use the title of the node for the quick item description (textfield) and the body of the node for an extended description (textarea). We also want to add a date field for a due date (date), a priority level for the tasks (drop down list), and a status field for the task's status (drop down list).

Also note, if you are going to create a module for public consumption, you should check to see if a similar module already exists in the contributions repository (published or otherwise). The community benefits far more from one well developed module than from many fragmented, half-completed or unmaintained modules. This node, for example, duplicates the task module from the contributions repository (this duplication is not good).

You should also become acquainted with Drupal coding and documentation standards as well as Writing secure code.

 
 

Drupal is a registered trademark of Dries Buytaert.