diff --git a/includes/media_youtube.formatters.inc b/includes/media_youtube.formatters.inc index a0ad95e266c1e9a7145fc794ea1d410f24c42131..00ae09953abfd9b225b0f6d9d1b097747e0ab71f 100644 --- a/includes/media_youtube.formatters.inc +++ b/includes/media_youtube.formatters.inc @@ -33,6 +33,7 @@ function media_youtube_file_formatter_info() { 'protocol' => 'https:', 'protocol_specify' => FALSE, 'rel' => TRUE, + 'iv_load_policy' => 1, 'showinfo' => TRUE, 'theme' => 'dark', ); @@ -67,7 +68,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') 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]; } return $element; @@ -154,6 +155,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', @@ -292,6 +302,7 @@ function media_youtube_file_default_displays_alter(&$file_displays) { 'showinfo' => 1, 'modestbranding' => 0, 'rel' => 1, + 'iv_load_policy' => 1, 'nocookie' => 0, 'protocol_specify' => 0, 'protocol' => 'https:', @@ -326,6 +337,7 @@ function media_youtube_file_default_displays_alter(&$file_displays) { 'showinfo' => 1, 'modestbranding' => 0, 'rel' => 1, + 'iv_load_policy' => 1, 'nocookie' => 0, 'protocol_specify' => 0, 'protocol' => 'https:', diff --git a/themes/media_youtube.theme.inc b/themes/media_youtube.theme.inc index 6bf886b23d6e88a0ef6a0e4ab152ea10d372629c..b9082d93c1e862ee4f7b863f1ddabc72e09a7a8a 100644 --- a/themes/media_youtube.theme.inc +++ b/themes/media_youtube.theme.inc @@ -53,6 +53,11 @@ function media_youtube_preprocess_media_youtube_video(&$variables) { $query['playlist'] = $variables['video_id']; } + // Video annotations. Default to 1. + if ($variable['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]) {