I switched from Alpha to Dev-branch of Media and File-Entity today which causes the following error-messages with WYSIWYG-editing for images and video-files (Vimeo):

Notice: Undefined index: file in media_wysiwyg_view_mode_form_alter() (line 97 of /MY_PATH_TO/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.module).
Notice: Trying to get property of non-object in file_view_file() (line 226 of /MY_PATH_TO/sites/all/modules/file_entity/file_entity.file_api.inc).
Warning: Creating default object from empty value in media_file_displays_alter() (line 1037 of /MY_PATH_TO/sites/all/modules/media/media.module).
EntityMalformedException: Missing bundle property on entity of type file. in entity_extract_ids() (line 7721 of /MY_PATH_TO/includes/common.inc).

File entity
7.x-2.0-alpha3+13-dev

Media
7.x-2.0-alpha3+77-dev

Media: Vimeo
7.x-2.0-rc1+7-dev

Wysiwyg
7.x-2.2+33-dev

CKEditor 4.3.3.7841b02

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Aslak’s picture

Had the same issue. Making this fix solved it for me. Looks like the cause is a pass by reference/value error introduced in bd2a854c.

esomething’s picture

The patch fixed the problem for me too. Thanks!

esomething’s picture

Well it fixed it for images but broke it for videos.

lorique’s picture

Status: Active » Needs review
Aslak’s picture

The error is caused by me running php 5.4, which is unsupported. The resolution is to downgrade to php 5.3. Disregard the patch.

lorique’s picture

Status: Needs review » Needs work

Changed status

jmuzz’s picture

Does it say somewhere that 5.4 isn't supported?

This seems like a reasonable solution to me. I'm not sure the video problems esomething saw are related to WYSIWYG. I can't even put something in a video field with the new versions, but this patch does seem to work for images in WYSIWYG.

jmuzz’s picture

Status: Needs work » Needs review

I managed to get a video attached to a field by browsing it and then submitting the node form without hitting the attach button first (which causes errors for me). Once that was done the video was in my library and I was able to embed it in the WYSIWYG by choosing it from there, but only if this patch is applied. Without it I got the same error as with images.

sylus’s picture

Status: Needs review » Reviewed & tested by the community

I just updated a fairly recent dev version (0d39e26) of media to latest dev (b2c2d78) and started getting this issue with my behat tests.

This patch fixed all issues.

Devin Carlson’s picture

Thanks for the patch!

Can someone post the steps to reproduce this using a fresh install of Media 7.x-2.x-dev? I'm not able to reproduce this locally and it would be great if I could add additional test coverage along with the changes in #1.

dw72’s picture

I have the same issue when try to simply add image in ckeditor using wysiwyg module (fresh upload or from media library... no matter) with latest dev of file_entity and media.

marcoka’s picture

i get "EntityMalformedException: Missing bundle property on entity of type file. in entity_extract_ids() (line 7721 of /MY_PATH_TO/includes/common.inc)." withg my media 2.x-dev
testing the patch now

aaron’s picture

Status: Reviewed & tested by the community » Needs work
sylus’s picture

I am not sure the issue in #12 is related to this issue. Once you remove this patch your missing entity of type file goes away?

cato’s picture

I'm seeing something similar in the latest dev versions of Media and File Entity. I can insert images but when I try to insert a PDF file it fails with EntityMalformedException. It doesn't seem like the entity has been loaded because $form['options'] is almost empty. I've documented it a bit more in this issue: https://drupal.org/node/2262107

cato’s picture

Related issue:

jmuzz’s picture

Status: Needs work » Needs review

I don't think marcoka was saying that the error is because of this patch.

das-peter’s picture

FileSize
630 bytes

As far as I can see the bug originates in media_wysiwyg_format_form().
The function itself manipulates $form_state but the parameter isn't passed as reference but as copy. Thus the changes stay in the local scope and are lost / not available later in the further form handling / in the form alteration hooks.
Because of that media_wysiwyg_view_mode_form_alter() accesses an non existent array item and triggers all subsequent issues.

cato’s picture

Tried the patch in #18. Still getting the same error though.

PI_Ron’s picture

Can confirm patch from #18 works with latest media dev:

; Information added by Drupal.org packaging script on 2014-05-04
version = "7.x-2.0-alpha3+80-dev"
core = "7.x"
project = "media"
datestamp = "1399223632"
fonant’s picture

I can confirm that the patch in #18 works here for media-7.x-2.0-alpha3+80-dev too. Thanks!

cato’s picture

@fonant @PI_Ron : have any of you tried to insert anything but images or video? I'm having the same issues with Document i.e. PDF files. The patch did not solve the issue for me.

das-peter’s picture

@cato: if your issue just is related to Document i.e. PDF files, and this patch fixes images for you too, I guess it definitely deserves an own issue.

cato’s picture

@das-peter FWIW now when I retest it on a clean download of latest media dev version its working. I think I might have applied another patch before testing #18 so I guess we're all ok now. Imma update the related issue too and point to #18 in this one.

Devin Carlson’s picture

Component: Media WYSIWYG View Mode » Media WYSIWYG
Status: Needs review » Fixed

Thanks for the patch and the reviews!

I tested #18 with an existing Media install and didn't run into any issues.

  • Commit 492b3c3 on 7.x-2.x authored by das-peter, committed by Devin Carlson:
    Issue #2223455 by Aslak, das-peter: Fixed Media WYSIWYG format form not...

Status: Fixed » Closed (fixed)

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