Guest User

Untitled

a guest
May 31st, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. /**
  2. * Implements template_preprocess().
  3. */
  4. function ft_common_preprocess_field_slideshow(&$variables) {
  5. foreach ($variables['items'] as $key => $item) {
  6. if ($item['type'] == 'video') {
  7. $wrapper = file_stream_wrapper_get_instance_by_uri($item['uri']);
  8. $source_img_path = $wrapper->getOriginalThumbnailPath();
  9. $image['path'] = $source_img_path;
  10.  
  11. $formatters = file_info_formatter_types();
  12. $settings = file_displays_load('video', 'default', TRUE);
  13.  
  14. // Get the formatter configuration.
  15. if (isset($settings['media_youtube_video']->settings)) {
  16. $options = $settings['media_youtube_video']->settings;
  17.  
  18. }
  19. // Get the default configuration if there is no configuration.
  20. else if (isset($formatters['media_youtube_video']['default settings'])) {
  21. $options = $formatters['media_youtube_video']['default settings'];
  22. }
  23.  
  24. if ($options) {
  25. //Setting the video.
  26. $video = array(
  27. 'uri' => $item['uri'],
  28. 'options' => $options,
  29. );
  30.  
  31. if (isset($variables['slides_max_width']) && isset($variables['slides_max_height'])) {
  32. $video['options']['width'] = $variables['slides_max_width'];
  33. $video['options']['height'] = $variables['slides_max_height'];
  34. }
  35. $variables['items'][$key]['image'] = theme('media_youtube_video', $video);
  36. }
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment