This is a sub-part of the larger patch proposed and already reviewed here: http://drupal.org/node/88633

The current code in function node_type_reset incorrectly assumes that the 'module' element of a node type will correspond to the module name. This is not true- the 'module' element can be defined arbitrarily, especially for modules that define multiple node types (see: http://drupal.org/node/64279#node-types).

Attached patch solves the bug in the simplest way by getting node info from all enabled modules.

Also, I think the type should be set before getting the defaults- reordered these two lines.

patch tested with 5.xRC1+ (current HEAD).

CommentFileSizeAuthor
#3 reset_node_types_2.diff749 bytespwolanin
reset_node_types_1.diff896 bytespwolanin

Comments

Jaza’s picture

Status: Reviewed & tested by the community » Needs work

why has the line $info = _node_type_set_defaults($info_array[$type->orig_type]); been moved below the line $info['type'] = $type->orig_type; ? The line $info['type'] = $type->orig_type; is now useless, as $info will now be overwritten on the next line. Either remove this line, or restore the two lines to their original order.

Other than that, looks good.

pwolanin’s picture

@Jaza- from looking at the code in the 'defaults' function, it seemed to me that it should go first.

Perhaps I need a better test- most module defined types have their 'type' locked, so the positioning of that line make no difference.

pwolanin’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new749 bytes

Ok, per Jaza's comment, this patch is now just a change to the one line. I tested the patch, and this one line change does enable the resetting of node types where the 'module' field is not the same as the name of the module.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)