node_get_module_name
Definition
node_get_module_name($node)
modules/node.module, line 213
Description
Determine the module that defines the node type of the given node.
Parameters
&$node Either a node object, a node array, or a string containing the node type.
Return value
A string containing the name of the defining module.
Code
<?php
function node_get_module_name($node) {
if (is_array($node)) {
if ($pos = strpos($node['type'], '-')) {
return substr($node['type'], 0, $pos);
}
else {
return $node['type'];
}
}
else if (is_object($node)) {
if ($pos = strpos($node->type, '-')) {
return substr($node->type, 0, $pos);
}
else {
return $node->type;
}
}
else if (is_string($node)) {
if ($pos = strpos($node, '-')) {
return substr($node, 0, $pos);
}
else {
return $node;
}
}
}
?> 