There is a check for the bundle on the referencing entity for the file preprocess that makes sure the bundle on the fieldable_panels_pane is media pane. However some entities have a different key name to 'bundle' (eg, for a node it is 'type' not 'bundle').

I propose fixing this using the following code change:

# On branch 7.x-1.x
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   media_pane.module
#
no changes added to commit (use "git add" and/or "git commit -a")
-sh-4.1$ git diff
diff --git a/media_pane.module b/media_pane.module
index edca125..bf673e3 100644
--- a/media_pane.module
+++ b/media_pane.module
@@ -57,7 +57,7 @@ function media_pane_get_view_mode_options() {
 function media_pane_preprocess_file_entity(&$variables) {
   $entity = $variables['referencing_entity'];
 
-  if ($entity->bundle != 'media_pane') {
+  if (!isset($entity->bundle) || $entity->bundle != 'media_pane') {
     return;
   }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yanniboi’s picture

Status: Active » Needs review
jamesrutherford’s picture

Issue summary: View changes
FileSize
830 bytes

Updated the patch to check and make sure referencing_entity is actually set, as it will not be on a direct file view ex: http://mysite.org/file/1

Status: Needs review » Needs work

The last submitted patch, 2: media_pane-render-bug-1983322-2.patch, failed testing.

jamesrutherford’s picture

FileSize
559 bytes

Resubmitting patch.

jamesrutherford’s picture

FileSize
603 bytes

Ok followed directions this time. Patch should be accepted.

jamesrutherford’s picture

Status: Needs work » Needs review

Moving to needs review.

wrd’s picture

Patch seems to work for me.

scottrigby’s picture

Status: Needs review » Reviewed & tested by the community

@jamesrutherford i literally just wrote the same check, before looking for an issue to add the patch. This is good :+1:

Anonymous’s picture

+1, affects media that's rendered via Media WYSIWYG as well. Patch makes this module play nice.

Christopher Riley’s picture

Patch #5 took care of a WSOD issue I was running into. Please commit this patch.

yanniboi’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
FileSize
559 bytes

Sorry guys, I committed a fix to this to the dev branch in 2013, but there was no 7.x-1.x-dev release.

I have re-rolled the patch because it didn't apply to dev, but will now.

  • jamesrutherford authored cf95f01 on 7.x-1.x
    Issue #1983322 by jamesrutherford, yanniboi: Bundle check in file...
yanniboi’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in release 7.x-1.1.

Status: Fixed » Closed (fixed)

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