The 'Select or Create' display is using Content Type Type rather than Content Type Name...

Comments

Lionfish’s picture

Assigned: Unassigned » Lionfish
Status: Active » Fixed

Fixed in v1.1 (next version I'll upload).

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!

Thanks,
Mike.

jlinares’s picture

If you're in addnode.module, you should prefix your function with 'addnode'. That is, _addnode_get_human_type_name.

nevets’s picture

Core contains the function node_get_types() to do this. You would call it something like

$name = node_get_types('type', $type);
Lionfish’s picture

Thanks nevets and jlinares, I've renamed my functions and am now using node_get_types.

(btw: should handlers be prefixed with an underscore?)

Anonymous’s picture

Status: Fixed » Closed (fixed)