Same name and namespace in other branches
  1. 5.x developer/examples/node_example.module \node_example_node_info()

Implementation of hook_node_info(). This function replaces hook_node_name() and hook_node_types() from 4.6.

This is a required node hook. This function describes the nodes provided by this module. The name value provide a human readable name for the node while the base value tells Drupal how the module's functions map to hooks (i.e. if the base is node_example_foo then node_example_foo_insert will be called when inserting the node).

File

developer/examples/node_example.module, line 54
This is an example outlining how a module can be used to define a new node type.

Code

function node_example_node_info() {
  return array(
    'node_example' => array(
      'name' => t('example node'),
      'base' => 'node_example',
    ),
  );
}