See http://api.drupal.org/api/function/node_get_types/7

It says:
"Builds a list of available node types, and returns all of part of this list in the specified format."
and:
"$op The format in which to return the list. When this is set to 'type', 'base', or 'name', only the specified node type is returned. When set to 'types' or 'names', all node types are returned."

So... what's the difference between 'types' and 'names'?
What about 'base'? What does that do?

Files: 
CommentFileSizeAuthor
#12 node_get_types-338402-12.patch2.13 KBrocket_nova
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]
#10 node_get_types-338402-10.patch2.13 KBrocket_nova
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]
#6 338402.patch2.25 KBjhodgdon
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 338402.patch. See the log in the details link for more information.
[ View ]

Comments

A number of modules are using this function incorrectly and showing a badly sorted list of node types to admin users, eg: Nodequeue (http://drupal.org/node/347272, and also Views.
So this really needs a fix.

From what I can tell:

'names' gets you an array of the form 'machine name' => 'human name' and it's sorted so the order looks right.
'types' (the default) gets you a list sorted the same as the query (so module weight?). A lot of modules are using this, then filtering the resulting array to get 'machine name' => 'human name' when they should be using 'names'.

Status:Active» Fixed

node_get_types() is renamed to:

node_type_get_types()
node_type_get_names()
node_type_get_type($node)
node_type_get_name($node)
node_type_get_base($node)

Those functions have pretty clear comments.

Version:7.x-dev» 6.x-dev
Status:Fixed» Active

Fixing the docs on 6 might still be a good idea; 6 will be supported for some time yet.

http://api.drupal.org/api/function/node_get_types/6 if anyone wants to look at the function doc.

Status:Active» Needs review
StatusFileSize
new2.25 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 338402.patch. See the log in the details link for more information.
[ View ]

Here's a patch to fix up this function doc.

Issue tags:+Novice

Gracious this is old.

The patch needs a reroll and a review. Reroll is good project for a novice contributor...

Status:Needs review» Needs work

Assigned:Unassigned» rocket_nova

Working on this at BADCamp.

Status:Needs work» Needs review
StatusFileSize
new2.13 KB
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Re-rolled patch from #6.

Status:Needs review» Needs work

There is a typo in the first line: I think the 1st "of" should be "or":
" and returns all of part of this list. "

Other than that, the patch looks good,... of course it would probably look good to me, since I wrote the original a while back... gracious, I hope someone else reviews it sooner than a year this time!

Status:Needs work» Needs review
StatusFileSize
new2.13 KB
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Ooo bummer. I even proof read this and totally missed that typo. Here is a re-roll.

Status:Needs review» Reviewed & tested by the community

Looks good to me now, thanks! Typos are one reason that we have people review patches -- happens to everyone. :)

Status:Reviewed & tested by the community» Fixed

Thanks, committed, pushed.

Status:Fixed» Closed (fixed)
Issue tags:-Novice

Automatically closed -- issue fixed for 2 weeks with no activity.