On a website that uses the Node Widget module, we found a bug where the AJAX/AHAH behavior on several of our filefields failed to insert the updated content of the field correctly. In the node form, when uploading a file as the first item of a file-/imagefield, instead of replacing just the content of this one item, the whole list of items got added again... meaning the table of uploaded files was added to this one table cell sort of nested inside itself. A second "Add another item" with broken AHAH behavior got added as well.
I managed to track it down to Node Widget's #process function and found out that Node Widget changes the #ahah path for these filefields even though they belong to a node type that isn't being used by Node Widget. This occurs because the IF-statement used to determine if 'node_widget' is part of the #parents array will return TRUE whenever '0' is part of the array – which is often the case with multi-value fields with deltas. See http://www.php.net/manual/en/function.in-array.php#86695.
I'm afraid I've yet to learn how to create and submit a patch but for anyone having problems with this, adding TRUE as a third argument to the in_array() call in _filefield_node_widget_process() solves the problem...
modules/filefield.node_widget.inc – Line #24
change...
if (in_array(NODE_WIDGET_VALUES, $element['#parents'])) {
into...
if (in_array(NODE_WIDGET_VALUES, $element['#parents'], TRUE)) {
I believe this only applies to the dev-version, since the -beta4 doesn't support/include filefields/imagefields.
Comments
Comment #1
sqeph commented