Closed (fixed)
Project:
Revision Moderation
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Jul 2007 at 18:51 UTC
Updated:
20 Dec 2007 at 00:01 UTC
I may have missed it, but I couldn't find this reported elsewhere.
When editing a revision for a node with CCK fields, none of the CCK fields show up on the edit screen. This appears to be because drupal_get_form is getting called with the form name 'revision_moderation_edit' and content.module is not adding it's fields via the form_alter hook (it is expecting the form name to be nodetype+'_node_form'.
This patch changes the way the edit callback is called to use the correct form name for editing the relevant node type. It should also help with any other modules that use hook_form_alter to add fields to the node form.
The patch: (also attached as file)
--- revision_moderation.module 2007-02-20 09:55:17.000000000 -0600
+++ revision_moderation.patched.module 2007-07-24 12:12:56.000000000 -0500
@@ -43,8 +43,8 @@ function revision_moderation_menu($may_c
$items[] = array(
'path' => 'node/'. arg(1) .'/revisions/'. arg(3) .'/edit',
'title' => t('Edit revision'),
- 'callback' => 'drupal_get_form',
- 'callback arguments' => array('revision_moderation_edit', arg(1), arg(3)),
+ 'callback' => 'revision_moderation_edit',
+ 'callback arguments' => array( arg(1), arg(3)),
'access' => $access,
'type' => MENU_CALLBACK,
);
@@ -303,7 +303,7 @@ function revision_moderation_get_node_pe
function revision_moderation_edit($nid, $vid) {
$node = node_load($nid, $vid);
drupal_set_message(t('You are currently editing a revision of this post created on @date by @author.', array('@date' => format_date($node->changed, 'small'), '@author' => $node->name)));
- return node_form($node);
+ return drupal_get_form($node->type .'_node_form', $node);
}
/**
| Comment | File | Size | Author |
|---|---|---|---|
| revision_edit_fix.patch | 1.05 KB | ronan |
Comments
Comment #1
ashtonium commentedThis patch fixed the problem for me. Thanks!
Comment #2
moonray commentedWorks for me as well.
Comment #3
moonray commentedJust to add: this patch allows the form to be displayed the way the original node form is, including all the hook_form_alter() made by custom modules (such as nodeteaser, nodewords, etc.), not just cck.
Comment #4
webchickNice catch. Committed. Thanks!
Comment #5
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.