node_example_node_info

Versions
4.7 – 7
node_example_node_info()

Implementation of hook_node_info(). This function replaces hook_node_name() and hook_node_types() from 4.6. Drupal 5 expands this hook significantly.

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 "module" value tells Drupal how the module's functions map to hooks (i.e. if the module is node_example_foo then node_example_foo_insert will be called when inserting the node). The "description" value provides a brief description of the node type, which will show up when a user accesses the "create content" page for that node type. Other attributes can also be defined through this hook, but only these ones are required.

Code

developer/examples/node_example.module, line 40

<?php
function node_example_node_info() {
  return array(
    'node_example' => array(
      'name' => t('example node'),
      'module' => 'node_example',
      'description' => t("This is an example node type with a few fields."),
    )
  );
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.