node fields not saving correctly on album edits

ankur - March 13, 2009 - 01:08
Project:Acidfree Albums
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I noticed that fields under the collapsed 'Other Fields' section don't get updated when you submit the form at node/[nid]/contents.

I took a closer look and it has to do with the way form_values are passed to the node processing in the submit handler for the 'acidfree_album_contents' form (that'd be the function acidfree_album_contents_form). At the end of that function, form values for a node submit in the album form are passed in a call to drupal_execute() for each node that editable on this page.

Unfortunately, since '#tree' => TRUE is used in the building of the 'acidfree_album_contents' form, what should be $fnode['body'] get's passed as $fnod['body_filter']['body'] to drupal_execute().

I'm guessing it's the same thing that's causing other fields to not get saved in other, similar issues:
http://drupal.org/node/136420
http://drupal.org/node/169125
http://drupal.org/node/157059
http://drupal.org/node/59439

The patch I've added only fixes the issue for the body field. I'm pretty certain that either this change needs to be made for everyfield, or there needs to be a more general fix that knows which keys in the $fnode array that's passed for the node's form_values should be nested and which shouldn't.

AttachmentSize
acidfree.diff.txt877 bytes

#1

ankur - March 13, 2009 - 02:08

Here's a correction to the previous patch.

The line that reads

              $fnode['body'] = $fnode['body_filter'];

should really be

              $fnode['body'] = $fnode['body_filter']['body'];

AttachmentSize
acidfree.diff.txt 885 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.