Révision 3acd948f
Ajouté par Assos Assos il y a plus de 6 ans
drupal7/sites/all/modules/media_youtube/themes/media_youtube.theme.inc | ||
---|---|---|
12 | 12 |
function media_youtube_preprocess_media_youtube_video(&$variables) { |
13 | 13 |
// Build the URI. |
14 | 14 |
$wrapper = file_stream_wrapper_get_instance_by_uri($variables['uri']); |
15 |
$parts = $wrapper->get_parameters(); |
|
16 |
if (isset($parts['v'])) { |
|
17 |
$variables['embed_type'] = 'video'; |
|
18 |
$variables['video_id'] = check_plain($parts['v']); |
|
19 |
$embed_path = '/embed/' . $variables['video_id']; |
|
15 |
if ($wrapper instanceof MediaReadOnlyStreamWrapper) { |
|
16 |
$parts = $wrapper->get_parameters(); |
|
17 |
if (isset($parts['v'])) { |
|
18 |
$variables['embed_type'] = 'video'; |
|
19 |
$variables['video_id'] = check_plain($parts['v']); |
|
20 |
$embed_path = '/embed/' . $variables['video_id']; |
|
21 |
} |
|
22 |
elseif (isset($parts['l'])) { |
|
23 |
$variables['embed_type'] = 'playlist'; |
|
24 |
$variables['video_id'] = check_plain($parts['l']); |
|
25 |
$embed_path = '/embed/videoseries'; |
|
26 |
} |
|
20 | 27 |
} |
21 |
elseif (isset($parts['l'])) { |
|
22 |
$variables['embed_type'] = 'playlist'; |
|
23 |
$variables['video_id'] = check_plain($parts['l']); |
|
24 |
$embed_path = '/embed/videoseries'; |
|
28 |
else { |
|
29 |
// This happens when stream wrappers are not yet initialized. This is |
|
30 |
// normally only encountered when creating content during profile install |
|
31 |
// using drush make. At that point, video_id is irrelevant anyway. |
|
32 |
$variables['video_id'] = ''; |
|
25 | 33 |
} |
26 | 34 |
|
27 | 35 |
// Checked existing function. |
... | ... | |
42 | 50 |
// Make css z-index work with flash object. Must be the first parameter. |
43 | 51 |
$query['wmode'] = 'opaque'; |
44 | 52 |
|
53 |
//YouTube video controls, on or off. |
|
54 |
if (isset($variables['options']['controls'])) { |
|
55 |
//on or off (TRUE/FALSE) depending on what is stored in $variables['options']['controls']. |
|
56 |
$query['controls'] = $variables['options']['controls']; |
|
57 |
} else { |
|
58 |
//on |
|
59 |
$query['controls'] = TRUE; |
|
60 |
} |
|
45 | 61 |
// These queries default to 0. If the option is true, set value to 1. |
46 | 62 |
foreach (array('autoplay', 'enablejsapi', 'loop', 'modestbranding') as $option) { |
47 | 63 |
if ($variables['options'][$option]) { |
Formats disponibles : Unified diff
Weekly update of contrib modules