nodeapi_example.module

Version 1.3.2.3 (checked in on 2006/07/23 at 02:34:50 by drewish)

This is an example outlining how a module can be used to extend existing content types.

We will add the ability for each node to have a "rating," which will be a number from one to five.

To store this extra information, we need an auxiliary database table.

Database definition:

<?php
  CREATE TABLE nodeapi_example (
    nid int(10) unsigned NOT NULL default '0',
    rating int(10) unsigned NOT NULL default '0',
    PRIMARY KEY (nid)
  )
?>

Functions & methods

NameDescription
nodeapi_example_form_alterImplementation of hook_form_alter().
nodeapi_example_helpImplementation of hook_help().
nodeapi_example_nodeapiImplementation of hook_nodeapi().
theme_nodeapi_example_ratingA custom theme function.