Media Version: 7.x-2.0-alpha4+27-dev
Media Gallery Version: 7.x-2.x-dev

I tried to create a new gallery and got blank white screen.

PHP error log:

PHP Fatal error: Call to undefined function media_attach_browser_js() in /drupal_site/sites/all/modules/media_gallery/media_gallery.module on line 317

Now I get the same when I got to default galleries page.

This comment says that:

It seems the media_include_browser_js() function doesn't exist in Media 2.x-dev.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mihail.Swetliy’s picture

I see this error only if a log in the system. If i see it as a quest - i have not problems with view.

Somebody can soled this problem?

SocialNicheGuru’s picture

Downgrade the media module.
The js helper functions were removed in the latest media module.
https://www.drupal.org/node/2465057

vulfox’s picture

You happen to remember which Media module version?

The module page should be updated with a notice like: "currently works with Media 7.xxxx" or something similar

SocialNicheGuru’s picture

This media version is working for me:

version = "7.x-2.0-alpha4+11-dev"
core = "7.x"
project = "media"
datestamp = "1416423187"

henryhu’s picture

"7.x-2.0-alpha4" of media is working for me.

mautumn’s picture

"7.x-2.0-alpha4" of media is working for me also. The latest dev release (27) wouldn't.

bsains’s picture

The last version with - media_attach_browser_js() is - Media version = "7.x-2.0-alpha4+26-dev"

As per the issue here - https://www.drupal.org/node/2454933 - this function was removed.

I've replaced media_attach_browser_js() on line 317 of media_gallery.module with the following and can report all OK.

-media_attach_browser_js($node->content['add_media_link']);
+drupal_add_library('media', 'media_browser');
+drupal_add_library('media', 'media_browser_settings');

As per the patch supplied in the above issue for CkEditor -

https://www.drupal.org/files/issues/Issue_2454933.patch

I'm hesitant to supply a patch as this will need some release co-ordination.

EDIT - OK - so just saw dependencies here - Media Gallery 2.x-dev requires Media 2.x-dev - so patch supplied

bsains’s picture

matthiasm11’s picture

I can confirm the patch from #8 works, thanks!

apratt’s picture

I too can confirm the patch in #8 worked well for me.

mallezie’s picture

Status: Active » Reviewed & tested by the community

This seems indeed the correct fix.

RedEight’s picture

#8 fixed the problem for me. I'm using Media 7.x-2.0-beta1, File Entity 7.x-2.0-beta2, and Media Gallery 7.x-2.x-dev.

kaido.toomingas’s picture

#8 worked for me too.

leolandotan’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
735 bytes

Hi guys, I'm using this patch also with Composer through the netresearch/composer-patches-plugin but it fails and gives me this error:

[Netresearch\Composer\Patches\PatchCommandException]                            
  Patch 0 would fail!                                                             
  Error executing command "patch -f -p1 --no-backup-if-mismatch -r - --dry-run":  
  (Stripping trailing CRs from patch.)                                            
  can't find file to patch at input line 3                                        
  Perhaps you used the wrong -p or --strip option?                                
  The text leading up to this was:                                                
  --------------------------                                                      
  |--- media_gallery.module	2014-11-23 23:55:56.000000000 +1100                   
  |+++ media_gallery.module	2015-05-14 11:39:43.426966818 +1000                   
  --------------------------                                                      
  No file to patch.  Skipping patch.                                              
  patch unexpectedly ends in middle of line                                       
  1 out of 1 hunk ignored   

I checked the patch and tried to apply it manually to 7.x-2.x-dev using `git apply -v this-patch.patch` but got the error the the file is corrupted and this patch got applied only through `patch -p0 ...`. I have read that this "style" has been deprecated already as said in Making a Drupal patch with Git. So I just created a patch using the said steps on the guide.

What are your thoughts on this?

kaido.toomingas’s picture

Hey guys I have to admit. I didn't use the patch. I just looked it and reproduced. I guess dev might be changed at some point and it wouldn't work anymore.

nedjo’s picture

Updated patch.

Changes:

  • Use #attached rather than directly calling drupal_add_library().
  • Remove now obsolete module_load_include() call.

Upgrading to critical as without this fix Media Gallery cannot be used with the current stable release of Media 2.x.

brandonc503’s picture

ok same problem
Call to undefined function media_attach_browser_js() sites/all/modules/media_gallery/media_gallery.module on line 317
so if i can start with ideal modules, which of Media and media gallery are best to start with? ie, can i get ideal modules and not have to patch at all?

cause i just downloaded media 7.x-2.x-dev and media gallery 7.x-2.x-dev hoping to fix and did not

edited*
Media 7.x-2.0-beta1, File Entity 7.x-2.0-beta2, and Media Gallery 7.x-2.x-dev. didnt work

edited*
[SOLVED] comment #16 the patch worked, thanks

  • Moloc committed 7c9b0cc on 7.x-2.x authored by nedjo
    Issue #2458471 by nedjo: Fixed call to undefined function...
Moloc’s picture

Status: Needs review » Fixed

Committed patch. So media_gallery is compatible with the latest stable version of media.
This patch will break compatibility with media versions < 2.x-beta1. So if you use the latest media-gallery 2.x dev, update media too.

See also: https://www.drupal.org/node/2550247

Moloc’s picture

Moloc’s picture

Status: Fixed » Closed (fixed)

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