function html5_media_add_resources in HTML5 Media 7
Adds the media player resources to the view.
1 call to html5_media_add_resources()
- html5_media_register_player in ./
html5_media.module - Register a new media player in JavaScript.
File
- ./
html5_media.module, line 435
Code
function html5_media_add_resources($template, $debug) {
static $resources_added = FALSE, $template_added = array();
// Get the player information.
$info = html5_media_get_player_info();
if (!$resources_added) {
// Add the media player library.
drupal_add_library('html5_media', $debug ? 'html5_player_debug' : 'html5_player');
// Iterate through all the plugins...
foreach ($info['plugins'] as $plugin) {
// Include all of the css and js files.
if ($plugin['js']) {
foreach ($plugin['js'] as $file => $options) {
drupal_add_js($file, $options);
}
}
if ($plugin['css']) {
foreach ($plugin['css'] as $file => $options) {
drupal_add_css($file, $options);
}
}
}
}
// Get the templates...
$templates = $info['templates'];
// If this template exists, then...
if (!isset($template_added[$template]) && isset($templates[$template])) {
// Statically cache this so we won't add it again.
$template_added[$template] = TRUE;
// Store the template info.
$template = $templates[$template];
// Include all of the template files.
if ($template['js']) {
foreach ($template['js'] as $file => $options) {
drupal_add_js($file, $options);
}
}
if ($template['css']) {
foreach ($template['css'] as $file => $options) {
drupal_add_css($file, $options);
}
}
}
}