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 define the name of a type of node.
Parameters
$node: Either the node type as a string, or a node object (in which case $node->type contains the node type as a string).
Return value
A string containing the node type name.
The most basic node module consists of only this hook. If the module defines only one type of node, then the function can consist of a single line returning the translated node type name.
For a detailed usage example, see node_example.module.
Related topics
8 functions implement hook_node_name()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- blog_node_name in modules/
blog.module - Implementation of hook_node_name().
- book_node_name in modules/
book.module - Implementation of hook_node_name().
- fileupload_node_name in developer/
examples/ fileupload.module - Node related code
- forum_node_name in modules/
forum.module - Implementation of hook_node_name().
- node_example_node_name in developer/
examples/ node_example.module - Implementation of hook_node_name().
File
- developer/
hooks/ node.php, line 184 - These hooks are defined by node modules, modules that define a new kind of node.
Code
function hook_node_name($node) {
switch (is_string($node) ? $node : $node->type) {
case 'project-issue':
return t('issue');
case 'project-project':
return t('project');
}
}