Used the following function to get the type's human name:
//This function returns the human readable name of a type (todo: Is there a drupal function that does this?)
function _get_human_type_name($type)
{
$query = "SELECT name FROM {node_type} WHERE type='%s'";
return db_result(db_query($query, $type));
}
if anyone knows of a drupal function to do a similar thing (or a better way of coding it) please post below!
Comments
Comment #1
Lionfish commentedFixed in v1.1 (next version I'll upload).
Used the following function to get the type's human name:
if anyone knows of a drupal function to do a similar thing (or a better way of coding it) please post below!
Thanks,
Mike.
Comment #2
jlinares commentedIf you're in addnode.module, you should prefix your function with 'addnode'. That is, _addnode_get_human_type_name.
Comment #3
nevets commentedCore contains the function node_get_types() to do this. You would call it something like
Comment #4
Lionfish commentedThanks nevets and jlinares, I've renamed my functions and am now using node_get_types.
(btw: should handlers be prefixed with an underscore?)
Comment #5
(not verified) commented