Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Upload module no longer work. nodeapi op=prepare is no longer called during when a node form is submitted.
The change that causes it is in drupal_get_form which uses the previously constructed form in the cache if it is available and the form is being submitted. This means node_form/node_object_prepare is never called on submit, and neither is form_alter, which is when/where upload.module currently adds new file data to the node and node_form respectively.
Comment | File | Size | Author |
---|---|---|---|
#7 | upload_previews_0.patch | 879 bytes | dopry |
#6 | upload_previews.patch | 1.04 KB | dopry |
#2 | 157747.patch | 640 bytes | dopry |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedrelated issue:
http://drupal.org/node/150463 => FAPI 3 problem -upload module fails when JS is disabled
See also the JS and callback here:
http://drupal.org/node/146425 => improve book module: use nodeapi and menu API
a second select is changed based on the first - and the cached form is altered to match. That's how eaton said to do FAPI3 AJAX: http://drupal.org/node/150859 (my writeup based on IRC w/ eaton and experimentation - put into practice in the book patch)
Comment #2
dopry CreditAttribution: dopry commentedI found we can just disable the form caching for nodes with uploads.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedwould it be better to implement upload_nodeapi('presave') instead? see top of node_save(). if not, this patch looks fine to me.
Comment #4
pwolanin CreditAttribution: pwolanin commentedDisabling form caching potentially breaks all AJAX callbacks - perhaps Jeff Eaton has had some new insight into this problem?
Comment #5
dopry CreditAttribution: dopry commentedI spoke with eaton a while back, he said the work of upload_prepare might be able to be done in a validate callback now. You should be able to set $form['#rebuild'] = TRUE in the validate callback to get the form properly rebuilt during submission. I haven't had any luck getting a validate callback called on the container for the upload form that contains the file data and new upload elements, and I currently have limited time resources to work on this. If someone else wants to run with it for a bit that would be awesome, unless some time magically appears for me in the next three weeks which I doubt I won't be able to work on this issue.
Comment #6
dopry CreditAttribution: dopry commentedActually in a quick ping pong with eaton we figured out that currently there are only a couple issues with new attachments not being rendered properly on previews in the attachment form, and other wise upload.module seems to be mostly well behaved again, except the type casting issue in the attached patch.
Comment #7
dopry CreditAttribution: dopry commentedhow about a patch without my debugging code.
Comment #8
drewish CreditAttribution: drewish commentedworks for me.
Comment #9
Gábor HojtsyThanks, committed!
Comment #10
(not verified) CreditAttribution: commented