Example: NodeAPI

Same name in other branches
  1. 6.x-1.x nodeapi_example/nodeapi_example.module \nodeapi_example

Example using NodeAPI.

This is an example demonstrating how a module can be used to extend existing node types.

hook_nodeapi() has been replaced in Drupal 7 with a set of different hooks providing the same or improved functionality. See the NodeAPI hooks list at api.drupal.org (linked below).

We will add the ability for each node to have a "rating," which will be a number from one to five. The rating will be tracked using the revision system also, so every node revision may have different rating values.

See also

Node API Hooks

Parent topics

File

nodeapi_example/nodeapi_example.module, line 8

Functions

Title Sort descending File name Summary
nodeapi_example_form_alter nodeapi_example/nodeapi_example.module Implements hook_form_alter().
nodeapi_example_node_delete nodeapi_example/nodeapi_example.module Implements hook_node_delete().
nodeapi_example_node_insert nodeapi_example/nodeapi_example.module Implements hook_node_insert().
nodeapi_example_node_load nodeapi_example/nodeapi_example.module Implements hook_node_load().
nodeapi_example_node_update nodeapi_example/nodeapi_example.module Implements hook_node_update().
nodeapi_example_node_validate nodeapi_example/nodeapi_example.module Implements hook_node_validate().
nodeapi_example_node_view nodeapi_example/nodeapi_example.module Implements hook_node_view().
nodeapi_example_schema nodeapi_example/nodeapi_example.install Implements hook_schema().
nodeapi_example_theme nodeapi_example/nodeapi_example.module Implements hook_theme().
nodeapi_example_uninstall nodeapi_example/nodeapi_example.install Implements hook_uninstall().
theme_nodeapi_example_rating nodeapi_example/nodeapi_example.module A custom theme function.

Classes

Title Sort descending File name Summary
NodeApiExampleTestCase nodeapi_example/nodeapi_example.test Functional tests for the NodeAPI Example module.