The recent CVS commit cleaning up the node_page() function broke the new ability to have modules define multiple node types. Specifically, when adding new nodes, arg(3) is not passed on to node_add(), so modules cannot differentiate between their multiple types. Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | node_2.diff | 1.44 KB | jonbob |
| #4 | node_0.diff | 792 bytes | jonbob |
| #3 | forum-module-fix.patch | 482 bytes | TDobes |
| node.diff | 633 bytes | jonbob |
Comments
Comment #1
dries commentedCommitted to HEAD. Thanks.
Comment #2
calanya commentedIf I try to create a new forum topic from a forum page (for example mysite.com/forum/5), I get to this page: mysite.com/node/add/forum/5. The patch you applied makes node module think the new node's type is "forum/5", when in fact it should be "forum".
Comment #3
TDobes commentedAs calanya noted, the multiple node type fix introduces a bug in forum.module causing it to no longer display forum nodes in the forum because they are assigned the wrong type. (Compare behavior with node.module 1.325 vs. 1.326) This more-or-less breaks forum.module, so I'm setting the priority to critical.
The attached patch fixes the problem by resetting a node type of 'forum' from within forum_form(). I have tested it, and it seems to work consistently (for forum.module anyway... some contrib modules might have issues as well, though)
Can someone more familiar with the multiple-node-type-per-module functionality please look at this patch and advise as to whether this is the best way to solve the problem?
Comment #4
jonbob commentedI suppose that would be me. :-)
To clarify the problem, it seems that forum.module relies on arg(3) to make new node add forms for a particular taxonomy selection. The node_pager() code sees this as a new content type instead.
The proposed method should work fine, but as stated would only fix forum.module, not other modules which may play with other arguments in node/add. As an alternate, the attached patch changes the behavior of node_add to check whether a node type exists before using arg(2)/arg(3) as a node type specifier. If not, it falls back on arg(2).
Comment #5
Steven commentedWouldn't a better solution be to use a different separator than / to separate module name from subtype? We treat the entire node-type as a single string throughout Drupal. By using a slash, we are splitting it up, because URL arguments behave as separate variables.
I don't think using module.subtype would be any dirtier in the URL.
Comment #6
dries commentedI don't like using a . (point) but I'd be OK with a - (dash) ...
Comment #7
dries commentedI think we are best of using a dash (-) to keeps the code simple and to avoid unexpected problems.
Comment #8
jonbob commentedThe attached patch changes the multiple type delimiter from / to -. Modules that use multiple content types will have to be updated. I will update hook documentation in contrib.
Comment #9
gábor hojtsyChange title to reflect current state of the issue (and bring it to attention).
Comment #10
dries commentedCommitted to HEAD. Thanks.
Comment #11
jonbob commentedTested for a while; seems fine.