function media_include_browser_js in D7 Media 7
Prepares the page to be able to launch the media browser.
Defines default variables.
1 call to media_include_browser_js()
- media_media_plugin in wysiwyg_plugins/
media.inc - Implementation of WYSIWYG's hook_INCLUDE_plugin().
File
- wysiwyg_plugins/
media.inc, line 46 - Define the WYSIWYG browser plugin.
Code
function media_include_browser_js() {
static $included;
if ($included) {
return;
}
$included = TRUE;
module_load_include('inc', 'media', 'includes/media.browser');
$javascript = media_browser_js();
foreach ($javascript as $key => $definitions) {
foreach ($definitions as $definition) {
$function = 'drupal_add_' . $key;
// Since the arguments to pass are variable, use call_user_func_array().
// This will not handle all potential drupal_add_*() functions directly
// but covers the js and library needed here, which are unlikely to be
// expanded since this function is only a workaround for a wysiwyg limitation.
call_user_func_array($function, $definition);
}
}
// Add wysiwyg-specific settings.
$settings = array(
'blacklist' => array(
'src',
'fid',
'view_mode',
'format',
),
);
drupal_add_js(array(
'media' => $settings,
), 'setting');
}