function _node_names in Drupal 4
3 calls to _node_names()
- node_get_base in modules/
node.module - Determine the basename for hook_load etc.
- node_get_name in modules/
node.module - Determine the human readable name for a given type.
- node_get_types in modules/
node.module - Return the list of available node types.
File
- modules/
node.module, line 214 - The core that allows content to be submitted to the site.
Code
function _node_names($op = '', $node = NULL) {
static $node_names = array();
static $node_list = array();
if (empty($node_names)) {
$node_names = module_invoke_all('node_info');
foreach ($node_names as $type => $value) {
$node_list[$type] = $value['name'];
}
}
if ($node) {
if (is_array($node)) {
$type = $node['type'];
}
elseif (is_object($node)) {
$type = $node->type;
}
elseif (is_string($node)) {
$type = $node;
}
if (!isset($node_names[$type])) {
return FALSE;
}
}
switch ($op) {
case 'base':
return $node_names[$type]['base'];
case 'list':
return $node_list;
case 'name':
return $node_list[$type];
}
}