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.
I am using Media 2.x-dev with media_ckeditor 2.x-dev and file_entity 2.x-dev
When using the media browser to insert an image into a ckeditor-enabled text field, I am unable to submit the media browser form that has the display-mode selection on it.
This is due to a javascript error "TypeError: Drupal.settings.media.formatFormFormats is null" at line 60 of media_wysiwyg.format_form.js.
Comment | File | Size | Author |
---|---|---|---|
#2 | media_wysiwg-javascript_view_modes_error-2552349-1.patch | 913 bytes | LittleRedHen |
Comments
Comment #2
LittleRedHen CreditAttribution: LittleRedHen commentedLooking into this, the
media_wysiwyg_format_form
function in media_wysiwyg.pages.inc loads the view mode information into$form_state['storage']['view_mode_previews']
, but then exports the non-existent$form_state['storage']['view_mode_output']
value to the javascript settings.Changing 'view_mode_output' to 'view_mode_previews' at line 48 corrects the issue.
From the file history, this was introduced by the fix for #2550453.
Comment #3
garbo CreditAttribution: garbo commentedI can confirm that the patch from #2 by LittleRedHen fixes the described bug.
Comment #4
davide.catani CreditAttribution: davide.catani as a volunteer commentedI confirm this solves the issue for me.
Thank you
Comment #5
drupalove CreditAttribution: drupalove as a volunteer commentedThis solves the javascript error for me.
Comment #6
BrightBoldThanks this solves the error for me too.
The wording of my error was
Uncaught TypeError: Cannot read property 'default' of null
(or replace default with whatever your view mode name is) in case anyone is looking for this issue by searching on that text.Comment #7
Dave ReidSorry this was my bad for the regression in media_wysiwyg.
Comment #8
Dave ReidCommitted #2 to 7.x-2.x.