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);
 }
 
 /**

CommentFileSizeAuthor
revision_edit_fix.patch1.05 KBronan

Comments

ashtonium’s picture

This patch fixed the problem for me. Thanks!

moonray’s picture

Status: Needs review » Reviewed & tested by the community

Works for me as well.

moonray’s picture

Just 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.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Nice catch. Committed. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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