diff --git a/includes/media_youtube.formatters.inc b/includes/media_youtube.formatters.inc index 87dc061..2900221 100644 --- a/includes/media_youtube.formatters.inc +++ b/includes/media_youtube.formatters.inc @@ -29,6 +29,7 @@ function media_youtube_file_formatter_info() { 'showinfo' => TRUE, 'theme' => 'dark', 'captions' => FALSE, + 'iv_load_policy' => 1, ), 'view callback' => 'media_youtube_file_formatter_video_view', 'settings callback' => 'media_youtube_file_formatter_video_settings', @@ -66,7 +67,7 @@ function media_youtube_file_formatter_video_view($file, $display, $langcode) { // Fake a default for attributes so the ternary doesn't choke. $display['settings']['attributes'] = array(); - foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'protocol', 'protocol_specify', 'rel', 'showinfo', 'theme', 'attributes', 'captions') as $setting) { + foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'protocol', 'protocol_specify', 'rel', 'iv_load_policy', 'showinfo', 'theme', 'attributes') as $setting) { $element['#options'][$setting] = isset($file->override[$setting]) ? $file->override[$setting] : $display['settings'][$setting]; } @@ -147,7 +148,7 @@ function media_youtube_file_formatter_video_settings($form, &$form_state, $setti '#default_value' => $settings['loop'], ); - // Note: make sure the positive/negative language lines up with option + // Note: make sure the positive/negitive language lines up with option // processing in media_youtube.theme.inc. $element['showinfo'] = array( '#title' => t('Display video title and uploader'), @@ -164,6 +165,15 @@ function media_youtube_file_formatter_video_settings($form, &$form_state, $setti '#type' => 'checkbox', '#default_value' => $settings['rel'], ); + $element['iv_load_policy'] = array( + '#title' => t('Video annotations'), + '#type' => 'radios', + '#options' => array( + '1' => t('Show video annotations (iv_load_policy=1)'), + '3' => t('Hide video annotations (iv_load_policy=3)'), + ), + '#default_value' => $settings['iv_load_policy'], + ); $element['nocookie'] = array( '#title' => t('Use privacy enhanced (no cookie) mode'), '#type' => 'checkbox', @@ -173,7 +183,7 @@ function media_youtube_file_formatter_video_settings($form, &$form_state, $setti '#title' => t('Specify an http protocol'), '#type' => 'checkbox', '#default_value' => $settings['protocol_specify'], - '#description' => t('An explicit protocol may be necessary for videos embedded in RSS feeds and emails. If no protocol is specified, iframes will be protocol relative.'), + '#description' => t('An explicit protocol may be neccesary for videos embedded in RSS feeds and emails. If no protocol is specified, iframes will be protocol relative.'), ); $element['protocol'] = array( '#title' => t('Iframe protocol'), @@ -246,7 +256,7 @@ function media_youtube_file_formatter_image_view($file, $display, $langcode) { if (empty($image_style) || !isset($valid_image_styles[$image_style])) { $element = array( '#theme' => 'image', - '#path' => str_replace('http:', '', $wrapper->getLocalThumbnailPath()), + '#path' => str_replace('http:', '', $wrapper->getOriginalThumbnailPath()), '#alt' => isset($file->override['attributes']['alt']) ? $file->override['attributes']['alt'] : $file->filename, ); } diff --git a/themes/media_youtube.theme.inc b/themes/media_youtube.theme.inc index 25e339e..4711bf0 100644 --- a/themes/media_youtube.theme.inc +++ b/themes/media_youtube.theme.inc @@ -52,6 +52,11 @@ function media_youtube_preprocess_media_youtube_video(&$variables) { $query['playlist'] = $variables['video_id']; } + // Video annotations. Default to 1. + if ($variables['options']['iv_load_policy'] !== 1) { + $query['iv_load_policy'] = $variables['options']['iv_load_policy']; + } + // These queries default to 1. If the option is false, set value to 0. foreach (array('rel', 'showinfo') as $option) { if (!$variables['options'][$option]) {