-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia_youtube-7.x-3.0-hidecontrols_and_playsinline.patch
58 lines (54 loc) · 2.62 KB
/
media_youtube-7.x-3.0-hidecontrols_and_playsinline.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff --git a/includes/media_youtube.formatters.inc b/includes/media_youtube.formatters.inc
index 970251f..b911d57 100644
--- a/includes/media_youtube.formatters.inc
+++ b/includes/media_youtube.formatters.inc
@@ -29,6 +29,8 @@ function media_youtube_file_formatter_info() {
'showinfo' => TRUE,
'theme' => 'dark',
'captions' => FALSE,
+ 'hidecontrols' => FALSE,
+ 'playsinline' => TRUE,
),
'view callback' => 'media_youtube_file_formatter_video_view',
'settings callback' => 'media_youtube_file_formatter_video_settings',
@@ -66,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', 'captions') as $setting) {
+ foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'protocol', 'protocol_specify', 'rel', 'showinfo', 'theme', 'attributes', 'captions', 'hidecontrols', 'playsinline') as $setting) {
$element['#options'][$setting] = isset($file->override[$setting]) ? $file->override[$setting] : $display['settings'][$setting];
}
@@ -146,6 +148,16 @@ function media_youtube_file_formatter_video_settings($form, &$form_state, $setti
'#type' => 'checkbox',
'#default_value' => $settings['loop'],
);
+ $element['hidecontrols'] = array(
+ '#title' => t('Hide controls'),
+ '#type' => 'checkbox',
+ '#default_value' => $settings['hidecontrols'],
+ );
+ $element['playsinline'] = array(
+ '#title' => t('Plays Inline (iOS)'),
+ '#type' => 'checkbox',
+ '#default_value' => $settings['playsinline'],
+ );
// Note: make sure the positive/negitive language lines up with option
// processing in media_youtube.theme.inc.
diff --git a/themes/media_youtube.theme.inc b/themes/media_youtube.theme.inc
index 25e339e..297632f 100644
--- a/themes/media_youtube.theme.inc
+++ b/themes/media_youtube.theme.inc
@@ -84,6 +84,14 @@ function media_youtube_preprocess_media_youtube_video(&$variables) {
}
}
}
+ if ($variables['options']['hidecontrols']) {
+ // Add controls parameters to the query.
+ $query['controls'] = '0';
+ }
+ if ($variables['options']['playsinline']) {
+ // Add iOS plays inline parameter to query.
+ $query['playsinline'] = '1';
+ }
// Non-query options.
if ($variables['options']['nocookie']) {