function background_video_preprocess_page in Background Video 7
Implements hook_preprocess_HOOK().
This function loads the Jquery Libraries and pass the configuration values to JS file.
File
- ./
background_video.module, line 108 - This file provides basic functionality.
Code
function background_video_preprocess_page(&$variables) {
$url_ogv = _background_video_geturl_preprocess_page('ogv');
$url_mp4 = _background_video_geturl_preprocess_page('mp4');
$url_webm = _background_video_geturl_preprocess_page('webm');
$url_poster = background_video_geturl_preprocess_page('poster');
$control_pos = variable_get('background_video_control_position', NULL);
$loop = variable_get('background_video_loop', NULL);
$video_id = check_plain(variable_get('background_video_id', NULL));
$auto_play = variable_get('background_video_autoplay', NULL);
if (!empty($url_ogv) && !empty($url_webm) && !empty($url_mp4) && !path_is_admin(current_path())) {
libraries_load('jquery-videobackground');
drupal_add_library('background_video', 'background_video');
drupal_add_js(array(
'background_video' => array(
'ogv' => $url_ogv,
'mp4' => $url_mp4,
'webm' => $url_webm,
'poster' => $url_poster,
'control_pos' => $control_pos,
'loop' => $loop,
'video_id' => $video_id,
'auto_play' => $auto_play,
),
), array(
'type' => 'setting',
));
}
}