When using the https://drupal.org/project/media_dev (2.x-dev) to test https://drupal.org/project/dragndrop_upload on simplytest.me, I get the following error when I try to edit the node:
Fatal error: Call to undefined function media_include_browser_js() in /home/sffaff83554c6381/www/sites/all/modules/dragndrop_upload/modules/dragndrop_upload_media/dragndrop_upload_media.module on line 113

This happens on a file or image field that is set to use the Drag & Drop Upload widget when you enable the "Use Media browser" checkbox setting.

Here are the settings that are checked:
The upload method is set to Automatic upload
Show Browse button
Use Media browser
Number of Values = Unlimited

To reproduce:
1. Use https://drupal.org/project/media_dev to test https://drupal.org/project/dragndrop_upload on simplytest.me
2. Edit the article field Image
3. Change the widget to Drag and Drop uploads
4. Set the same settings I used above.
5. Edit the node and see the error

Hope that helps

Comments

gmclelland’s picture

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

I wonder if it instead should be the function media_attach_browser_js(&$element) in media/includes/media.browser.inc

or maybe the function media_browser_js() in media/includes/media.browser.inc?

There is also a media_wysiwyg_include_browser_js() in media/modules/media_wysiwyg/media_wysiwyg.module. This might be what you need?

Hope that helps

webevt’s picture

Title: Fatal error: Call to undefined function media_include_browser_js() » Media 2.x integration
Status: Active » Needs work

Hi

Thanks for your report.

Media 2.x moved media_include_browser_js() function into new media_wysiwyg module and renamed it it to media_wysiwyg_include_browser_js(). Using this function will solve the fatal error problem, but media integration will not work anyway. It seems that maintainers have vastly reworked the Media API, so current implementation will not work with this version. I set version restriction dependency for Media module to 1.x, so it will be impossible to use media integration with Media 2.x until I implement it.

Regards

gmclelland’s picture

Good to know. Thanks for update.

webevt’s picture

Category: Bug report » Task
rooby’s picture

Media 2.x is still changing quite a lot so it's probably best to wait for at least the next recommended release comes out.
Hopefully the next release will be beta.

ttronslien’s picture

Any plans to revisit this issue in near future?

rooby’s picture

Media 2.x is definitely much more stable now.

Zemelia’s picture

Seems that latest dragndrop_upload dev version is OK with latest Media 2.x

mfernea’s picture

Status: Needs work » Needs review
StatusFileSize
new948 bytes

I can confirm too that the latest dev (7.x-1.0-alpha2+11-dev) + this patch works with media (2.0-beta1). I recreated the patch as it needed correct paths.

mfernea’s picture

Status: Needs review » Needs work

Actually it's not working as it should. When the media browser popup is opened the "Library" and "My files" tabs are shown twice.

joseph.olstad’s picture

looks like a simple enough patch, very cool would like to try this some time.

lucasantunes’s picture

Hello! I'm currently not able to add a patch file, but here is what worked for me. Hope it helps someone else as well. I got it from the following comment: https://www.drupal.org/project/media/issues/2454933#comment-9737591

diff --git a/modules/dragndrop_upload_media/dragndrop_upload_media.module b/modules/dragndrop_upload_media/dragndrop_upload_media.module
index 1f42b093..7c04e4a7 100644
--- a/modules/dragndrop_upload_media/dragndrop_upload_media.module
+++ b/modules/dragndrop_upload_media/dragndrop_upload_media.module
@@ -109,8 +109,8 @@ function dragndrop_upload_media_pre_render($element) {
     ),
   );
 
-  module_load_include('inc', 'media', 'wysiwyg_plugins/media');
-  media_include_browser_js();
+  drupal_add_library('media', 'media_browser');
+  drupal_add_library('media', 'media_browser_settings');
 
   return $element;
 }
amittarkar’s picture

@lucasantunes, the patch you provided worked out of the box but The 'file uri' interface in the media browser is quit cumbersome for the locally stored media files on the pc,So how to have normal browse button like that of Drag and Drop upload ( without media browser) in the media browser itself .

joseph.olstad’s picture

for lucasantunes
how to apply a patch