node_example_node_info
Definition
node_example_node_info()
developer/examples/node_example.module, line 50
Description
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 required attributes are:
- "name" provides a human readable name for the node,
- "module" 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).
- "description" provides a brief description of the node type, which is show up when a user accesses the "Create content" page for that node type.
- "has_title" boolean that indicates whether or not this node type has a title field.
- "title_label": the label for the title field of this content type.
- "has_body": boolean that indicates whether or not this node type has a body field.
- "body_label": the label for the body field of this content type.
- "min_word_count": the minimum number of words for the body field to be considered valid for this content type.
Code
<?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."),
'has_title' => TRUE,
'title_label' => t('Example Title'),
'has_body' => TRUE,
'body_label' => t('Example Body'),
)
);
}
?> 