Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements template_preprocess().
- */
- function ft_common_preprocess_field_slideshow(&$variables) {
- foreach ($variables['items'] as $key => $item) {
- if ($item['type'] == 'video') {
- $wrapper = file_stream_wrapper_get_instance_by_uri($item['uri']);
- $source_img_path = $wrapper->getOriginalThumbnailPath();
- $image['path'] = $source_img_path;
- $formatters = file_info_formatter_types();
- $settings = file_displays_load('video', 'default', TRUE);
- // Get the formatter configuration.
- if (isset($settings['media_youtube_video']->settings)) {
- $options = $settings['media_youtube_video']->settings;
- }
- // Get the default configuration if there is no configuration.
- else if (isset($formatters['media_youtube_video']['default settings'])) {
- $options = $formatters['media_youtube_video']['default settings'];
- }
- if ($options) {
- //Setting the video.
- $video = array(
- 'uri' => $item['uri'],
- 'options' => $options,
- );
- if (isset($variables['slides_max_width']) && isset($variables['slides_max_height'])) {
- $video['options']['width'] = $variables['slides_max_width'];
- $video['options']['height'] = $variables['slides_max_height'];
- }
- $variables['items'][$key]['image'] = theme('media_youtube_video', $video);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment