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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LittleRedHen created an issue. See original summary.

LittleRedHen’s picture

Looking 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.

garbo’s picture

I can confirm that the patch from #2 by LittleRedHen fixes the described bug.

davide.catani’s picture

I confirm this solves the issue for me.

Thank you

drupalove’s picture

Status: Needs review » Reviewed & tested by the community

This solves the javascript error for me.

BrightBold’s picture

Thanks 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.

Dave Reid’s picture

Sorry this was my bad for the regression in media_wysiwyg.

Dave Reid’s picture

Status: Reviewed & tested by the community » Fixed

Committed #2 to 7.x-2.x.

Status: Fixed » Closed (fixed)

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