Article

Media modules Fatal error: Call to undefined function media_include_browser_js() in

As of Drupal Media module version 2 and 3, there are a lot of modules, contributed or custom which have yet to upgrade its code to complement with Media's major overhaul. Notably, this error I kept encountering with Drupal 7 projects:

Fatal error: Call to undefined function media_include_browser_js() in

To troubleshoot and fix this:

  1. Under your contributed module directory (normally sites/all/modules/), search and find for:
    media_include_browser_js();
     
  2. Backup those modules
  3. Comment out that line or lines found, then replace with:
    drupal_add_library('media', 'media_browser');
    drupal_add_library('media', 'media_browser_settings');
     
  4. Under the same modules directory, search and find this time for:
    include_once drupal_get_path('module', 'media') . '/wysiwyg_plugins/media.inc';
     
  5. Backup those modules, if these are different from above
     
  6. Comment out that line or lines found, the location of the plugin below needs to be updated to:
    include_once drupal_get_path('module', 'media') . '/modules/media_wysiwyg/wysiwyg_plugins/media.inc';
Clear and flush all cache. Refresh page. 
Tags: