I may be expecting bad behavior here. In the past if I modified node_field in hook_widget op='prepare form values' since node_field it passed in by reference I would have that data in the rest of the cycle. I use it normally as the place where I process attached files, and append them to node field... oddly enough it works if I am updating a node, but not on node creation.

After a little exploration... I discovered if $node->$field['field_name'] is not set, but 'prepare form values' adds some data to it, it won't get appended to the node... see attached patch for more details...

CommentFileSizeAuthor
content.module-add.patch.txt671 bytesdopry

Comments

karens’s picture

Status: Active » Fixed

I confirmed this problem exists and that the patch fixes it. It's actually a pretty critical bug since widgets were unable to add values when creating a node, only when updating it. The same problem exists in the invokation of hook_field, so I fixed that, too. It is possible that it could be simplified to only test count($node_field) instead of both $node->$field['field_name'] and $node_field, but I did't want to take any chance of breaking anything, so I left it this way.

Anonymous’s picture

Status: Fixed » Closed (fixed)