Rather than selecting a file via pre-built JSON and including all the possible files via drupal_add_js(), we should rather update the media thumbnail via AJAX request like file/%file/ajax/preview.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Maybe as a next step beyond this, we should probably be updating the entire widget for that delta once a file is selected. Say for instance that the user changes a field value on the file, which is used to determine entity access.

larowlan’s picture

Status: Active » Needs review
FileSize
527 bytes

This works for me

mstrelan’s picture

I'm getting "Strict warning: Only variables should be passed by reference in media_file_edit_modal()" with this patch. Updated patch attached.

kim.pepper’s picture

FileSize
760 bytes

Attaching interdiff between #2 and #3

m1r1k’s picture

Status: Needs review » Reviewed & tested by the community

Works great for me

grom358’s picture

Patch for 7.x-2.0-beta1 release.

Dave Reid’s picture

  • Dave Reid committed fc1c812 on 7.x-2.x authored by grom358
    Issue #1701914 by larowlan, mstrelan, grom358, kim.pepper, Dave Reid:...
Dave Reid’s picture

Title: Update the media thumbnail via AJAX when media browser or edit file modal is closed » Update the media thumbnail via AJAX when edit file modal is closed
Status: Reviewed & tested by the community » Fixed

Committed #3 to 7.x-2.x. Nice work everyone, that ended up being way easier than expected!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.