Steps to reproduce :
- create a multiple file field (or change the 'image' field on articles to accept unlimited values)
- create a node with two files A and B, save
- edit the node, change the order of files (B, A), hit 'Preview' (or, alternatively, empty the 'Node title' input and hit 'Save')
--> When the form is redisplayed (after preview, or because of failed form validation), the visual order of files is lost (back to A, B).
theme_file_widget_multiple() has some code to sort widgets according to incoming 'weight' #values (similar to what the default theme_field_multiple_value_form() does), but in fact ditches that info and goes with element_children() order instead.
Attached patch actually uses the sorted array as a base for rendering order.
Note that this is *not* related to #819816: (Needs tests) Reordering multivalue file and image field uploads is broken, which deals with file values order not being accounted for in saved objects.
| Comment | File | Size | Author |
|---|---|---|---|
| file_field_theme_order.patch | 4.28 KB | yched |
Comments
Comment #1
yched commentedfile_field_theme_order.patch queued for re-testing.
Comment #3
yched commentedHm ? Try again.
file_field_theme_order.patch queued for re-testing.
Comment #4
montesq commented@yched
After testing on my side, I confirm your patch fix well the issue.
Comment #5
montesq commentedComment #6
tom_o_t commentedfile_field_theme_order.patch queued for re-testing.
Comment #7
webchickLooks sane. I'd like to get a quick test for this, but I don't know that it's possible since it involves JS. But reordering fields has been broken so much this release. :(
Committed to HEAD.