With #2121253: Attach media browser JavaScript settings and #2316707: Drupal.settings.media values become an array of when multiple fields are used the media browser settings were "simplified" and moved to a library which makes the media_attach_browser_js() and media_browser_js() helper functions unnecessary, since they require more code and the loading of a file, compared to simply #attaching the library.
Ex:
module_load_include('inc', 'media', 'includes/media.browser');
$javascript = media_browser_js();
foreach ($javascript as $key => $definitions) {
foreach ($definitions as $definition) {
$element['#attached'][$key][] = $definition;
}
}
vs.
$element['#attached']['library'][] = array('media', 'media_browser');
$element['#attached']['library'][] = array('media', 'media_browser_settings');
The media_browser library should probably depend on the settings library anyway, which would remove the second line as well.
Comments
Comment #1
devin carlson commentedA patch to remove the functions.
Comment #2
devin carlson commentedTested #1 and committed to Media 7.x-2.x.
Comment #4
steel-track commentedJust a heads up that this causes a function undefined error with the CKeditor module's plugin loading:
ckeditor/includes/ckeditor.lib.inc line 893
Are they aware of this change?
Comment #5
polHere's the patch.
And the line for you, makefile lovers:
projects[ckeditor][patch][] = https://www.drupal.org/files/issues/Issue_2454933.patchComment #6
polComment #7
steel-track commented@Pol - Thanks for the patch!
Comment #8
lunk rat commentedPatch in #5 solves this for me. I just upgraded from media 1.x to 2.x-dev and ckeditor was giving
Fatal error: Call to undefined function media_browser_js() in ckeditor/includes/ckeditor.lib.inc on line 893So when #1 makes it into a full release, will you submit #5 to be committed to ckeditor module?
Comment #9
izmeez commentedThis patch in #5 applies to ckeditor and has been filed in it's own issue #2455391: Call to undefined function media_browser_js() latest Media-7.x-2.x-dev
Further discussion should be there.
Comment #11
ddease2 commented#25 worked for me