function hook_node_info

You are here

7 node.api.php hook_node_info()
4.7 node.php hook_node_info()
5 node.php hook_node_info()
6 node.php hook_node_info()

Define the human-readable name of a node type.

This is a hook used by node modules. This hook is required of modules that define a node type. It is called to determine the names of the module's nodes.

Return value

An array of information on the module's nodes. The array contains a sub-array for each node with the node name as the key. Each sub-array has two elements, 'name' and 'base'.

The 'name' value is a human-readable name for the node and while the 'base' value tells Drupal how a module's functions map to hooks (i.e. if the base is example_foo then example_foo_insert will be called when inserting the node).

To prevent namespace conflicts, each node type defined by a module should be prefixed by the name of the module and an underscore.

For a detailed usage example, see node_example.module.

Related topics

9 functions implement hook_node_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

blog_node_info in modules/blog.module
Implementation of hook_node_info().
book_node_info in modules/book.module
Implementation of hook_node_info().
fileupload_node_info in developer/examples/fileupload.module
Implementation of hook_node_info.
forum_node_info in modules/forum.module
Implementation of hook_node_info().
multipage_form_example_node_info in developer/examples/multipage_form_example.module
Implementation of hook_node_info().

... See full list

3 invocations of hook_node_info()
user_auth_help_links in modules/user.module
user_help in modules/user.module
Implementation of hook_help().
_node_names in modules/node.module

File

developer/hooks/node.php, line 42
These hooks are defined by node modules, modules that define a new kind of node.

Code

function hook_node_info() {
  return array(
    'project_project' => array(
      'name' => t('project'),
      'base' => 'project_project',
    ),
    'project_issue' => array(
      'name' => t('issue'),
      'base' => 'project_issue',
    ),
  );
}