hook_node_name

Versions
4.6
hook_node_name($node)

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.

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.

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.

Related topics

Code

developer/hooks/node.php, line 184

<?php
function hook_node_name($node) {
  switch (is_string($node) ? $node : $node->type) {
    case 'project-issue':
      return t('issue');
    case 'project-project':
      return t('project');
  }
}
?>
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.