Example: Node

Same name in other branches
  1. 7.x-1.x node_example/node_example.module \node_example

Creating a new content type in a module. (drupal 6)

This is an example outlining how a module can be used to define a new node type.

(Note that custom node types are most often created with CCK in recent versions of Drupal.)

Our example node type will allow users to specify a "color" and a "quantity" for their nodes; some kind of rudimentary inventory-tracking system, perhaps? To store this extra information, we need an auxiliary database table as defined in node_example_schema().

This example is part of the Examples for Developers Project which you can download and experiment with here: http://drupal.org/project/examples

Parent topics

File

node_example/node_example.module, line 17

Functions

Title Sort descending File name Summary
node_example_access node_example/node_example.module Implementation of hook_access().
node_example_delete node_example/node_example.module Implementation of hook_delete().
node_example_form node_example/node_example.module Implementation of hook_form().
node_example_info node_example/node_example.module Explain how the module demonstrates a new node type.node_example.test
node_example_insert node_example/node_example.module Implementation of hook_insert().
node_example_load node_example/node_example.module Implementation of hook_load().
node_example_menu node_example/node_example.module Implementation of hook_menu().
node_example_nodeapi node_example/node_example.module Implementation of hook_nodeapi().
node_example_node_info node_example/node_example.module Implementation of hook_node_info().
node_example_perm node_example/node_example.module Implementation of hook_perm().
node_example_theme node_example/node_example.module Implementation of hook_theme().
node_example_update node_example/node_example.module Implementation of hook_update().
node_example_validate node_example/node_example.module Implementation of hook_validate().
node_example_view node_example/node_example.module Implementation of hook_view().
theme_node_example_order_info node_example/node_example.module A custom theme function.