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.
in file.field.inc:
file_field_widget_value()
file_field_widget_multiple_count_validate()
file_field_widget_process()
file_field_widget_process_multiple()
_file_field_get_description_from_element()
file_field_widget_submit()
in image.field.inc:
image_field_widget_process()
_image_field_required_fields_validate()
It seems those should move to the FileWidget / ImageWidget classes ?
Comment | File | Size | Author |
---|---|---|---|
#17 | file-widget-callbacks-2072995-17.patch | 37.8 KB | claudiu.cristea |
Comments
Comment #1
yched CreditAttribution: yched commentedsame in image.field.inc, actually - updated the OP
Comment #2
yched CreditAttribution: yched commentedNote: those functions were probably left out during the patches that converted the widgets to classes several months ago because FAPI / render API didn't support "callbacks as methods" for all callbacks (process, pre_render...).
I'm not 100% sure where we stand right now on this regard, would need to be double checked for each callback type involved here.
Comment #3
claudiu.cristeaLet me try :)
Comment #4
claudiu.cristeaComment #5
claudiu.cristeaVoilà!
Comment #7
claudiu.cristeaTo be honest, even now I'm not sure how to pass by reference with
call_user_func_array()
in 5.3 compared to 5.4. This works on PHP 5.4, let's see the bot.Comment #8
claudiu.cristeaI just copied this piece of code from the legacy callback but looking a little bit inside it doesn't look good to me. Isn't this wrong? I mean the "else" part
$new_value = $submitted_value;
? It seems that we drop out the submitted value when $submitted_value['fids'] is not an array?Comment #8.0
claudiu.cristeaimage
Comment #9
claudiu.cristea7: file-widget-callbacks-2072995-7.patch queued for re-testing.
Comment #11
claudiu.cristeaReworked the patch. The interdiff is not relevant as the patch was seriously outdated. @yched please check also the comment from #8.
Comment #12
yched CreditAttribution: yched commentedWould love if someone could help review that one ;-)
Comment #13
amateescu CreditAttribution: amateescu commentedLooks fine to me.
Comment #14
LinL CreditAttribution: LinL commented11: file-widget-callbacks-2072995-11.patch queued for re-testing.
Comment #16
yched CreditAttribution: yched commentedAnyone up for a reroll ?
If the patch doesn't apply anymore, it probably means that some changes have been committed inside the old functions meanwhile, so the reroll will need to make sure that those changes are correclty reported in the new methods...
Comment #17
claudiu.cristearerolled
Comment #18
yched CreditAttribution: yched commentedThanks @claudiu.cristea !
Comment #19
xjm17: file-widget-callbacks-2072995-17.patch queued for re-testing.
Comment #20
xjmThis patch has been in the reroll-and-RTBC cycle for more than four weeks, so tagging accordingly.
Comment #21
yched CreditAttribution: yched commented17: file-widget-callbacks-2072995-17.patch queued for re-testing.
Comment #23
xjmComment #24
xjmd.o doesn't like the + apparently.
Comment #25
yched CreditAttribution: yched commentedAnyone up for reroll ? :-)
Comment #26
longwaveNo reroll needed that I can see, testbot ran out of disk space on the last run.
17: file-widget-callbacks-2072995-17.patch queued for re-testing.
Comment #27
claudiu.cristeaNeeds re-RTBC, @yched?
Comment #28
yched CreditAttribution: yched commentedOh, sorry. Damn random fails :-/
Comment #29
webchickCommitted and pushed to 8.x.
We'll need a change notice for this.
Comment #30
j4 CreditAttribution: j4 commentedChange Record created.
Comment #31
yched CreditAttribution: yched commented@j4: thanks for this !
A couple remarks:
- The change notice should reference this issue (there's an "Issues" reference field to fill in (you have to paste the current title of the issue for the autocomplete to work)
- The text should include the names of the functions that were moved around, so that the change records shows up when people search for a function name at https://drupal.org/list-changes/drupal when their code breaks with "fatal, undefined function foobar()"
- It should also outline how to fix the broken code. In this case, a simple map of "old function() -> new class::method()" would be enough.
See https://drupal.org/node/2064123 for an example of table formatting.
Comment #32
j4 CreditAttribution: j4 commentedHi yched,
Thank you for the mentoring! Am not a very technical person, but wanted to pitch in...:)
Have added the issue to the change record (was having an issue with the auto-complete, the auto-complete text appears at the top of the screen and not below the field).
Will try and understand the other two recommendations and make the corrections as soon as I get the hang of it.
Jaya
Comment #33
xjmTagging "Missing change record", as completing the change record updates here blocks a beta: #2083415: [META] Write up all outstanding change notices before release
Comment #34
xjmMarking "Needs work" to incorporate @yched's feedback in the change record.
Comment #35
webchickChange record is there, just needs a bit more tweaking.
Comment #36
swentel CreditAttribution: swentel commentedMm, fileWidget contains an unused variable on line 519 ($new_value).
Also, if you set images to multiple (or at least unlimited in our testing), it somehow forgets it's multiple and the widget printing looks bad.
Coming from #2172241: Files and image widgets completely broken which plopsec was investigating the file validation there, but also stumbled on the fact that valid images/files are now bad too when being multiple. Note that we're not sure yet if this issue caused that second regression.
Comment #37
mgiffordJust unassigning issues that haven't been developed for a bit in the D8 queue.
Comment #38
claudiu.cristeaUpdated the change notice. Back to RTBC for closing.
Comment #40
claudiu.cristeaI think "Fixed" is better :)