Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Steps to reproduce:
Use https://drupal.org/project/media_dev on simplytest.me:
1. Add an article and embed an image using the wysiwyg editor and set "Display as" to "Preview" and Submit
2. Now reselect the image and click on the media browser button. In the modal dialog use will see a preview of the image except that it is really big instead of an tiny "Preview" thumbnail from the "Preview" view mode.
Comments
Comment #1
ndewhurstI noticed the same thing on one of our sites, and wrote this patch. It now also checks the GET request for a format, which is where media_wysiwyg_format_form gets it (see media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc). If no valid format is found, it falls back to the global default.
As an aside, I thought of changing "media_wysiwyg_view_mode_form_alter" to "media_wysiwyg_view_mode_form_media_wysiwyg_format_form_alter," since it only alters that one form presently, but I didn't want to step outside the scope of this issue.
Comment #2
bneil CreditAttribution: bneil commentedI tested the patch and it works as expected. In the test case above, the image is rendered as the correct "preview" view mode when reselecting the image and clicking the media button.
Comment #3
aaron CreditAttribution: aaron commentedCommitted to http://drupalcode.org/project/media.git/commit/7fdafec.
Comment #5
ndewhurstUnfortunately, this code seems to have been lost in a subsequent update. As far as I can tell, this is what happened:
1e037401dc7ca2cfcfbe4948e97b25c9f61d409b
, which removed this code.media_wysiwyg_view_mode_form_alter()
tomedia_wysiwyg_view_mode_form_media_wysiwyg_format_form_alter()
(sweet!) and revised the code therein.$form['#formats']
rather than recreating a file usingfile_view_file()
).I'm guessing this was an unintended side effect, but can't say for sure just by looking from the outside. Hopefully someone can clarify, and if it was unintentional, restore this functionality.
The attached patch is very similar to the one I wrote above, but applies to the current 7.x-2.x code. It's working very well for me in my initial usage/testing.
Comment #6
emptyvoid CreditAttribution: emptyvoid commentedThe provided patch didn't diff correctly.
I've rerolled the patch against the current dev release.
Comment #8
joseph.olstadComment #9
joseph.olstadpatch #5 is the good one..
Comment #11
joseph.olstad