<?php

/**
 * @file
 *
 */

function incubator_file_default_displays() {
  $file_displays = array();
  
  // Audio wysiwyg

  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'audio__wysiwyg__file_field_media_large_icon';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => 'media_thumbnail',
  );
  $file_displays['audio__wysiwyg__file_field_media_large_icon'] = $file_display;  
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'audio__wysiwyg__file_field_file_default';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = '';
  $file_displays['audio__wysiwyg__file_field_file_default'] = $file_display;
  
  // Document display and wysiwyg
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'document__preview__file_field_file_default';
  $file_display->weight = 50;
  $file_display->status = TRUE;
  $file_display->settings = '';
  $file_displays['document__preview__file_field_file_default'] = $file_display;
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'document__default__file_field_file_default';
  $file_display->weight = 0;
  $file_display->status = TRUE;
  $file_display->settings = '';
  $file_displays['document__default__file_field_file_default'] = $file_display;
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'document__teaser__file_field_media_large_icon';
  $file_display->weight = 0;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => 'incubator_icon',
  );
  $file_displays['document__teaser__file_field_media_large_icon'] = $file_display;
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'document__wysiwyg__file_field_file_default';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = '';
  $file_displays['document__wysiwyg__file_field_file_default'] = $file_display;

  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'document__wysiwyg__file_field_media_large_icon';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => 'media_thumbnail',
  );
  $file_displays['document__wysiwyg__file_field_media_large_icon'] = $file_display;
  
  // Image wysiwyg
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'image__wysiwyg__file_field_image';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => '',
    'image_link' => '',
  );
  $file_displays['image__wysiwyg__file_field_image'] = $file_display;
  
  // Video wysiwyg
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'video__wysiwyg__media_vimeo_image';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => 'large',
  );
  $file_displays['video__wysiwyg__media_vimeo_image'] = $file_display;

  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'video__wysiwyg__media_youtube_image';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => 'large',
  );
  $file_displays['video__wysiwyg__media_youtube_image'] = $file_display;

  // Video teaser image displays
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'video__teaser__media_vimeo_image';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => 'thumbnail',
  );
  $file_displays['video__teaser__media_vimeo_image'] = $file_display;
  
  $file_display = new stdClass();
  $file_display->api_version = 1;
  $file_display->name = 'video__teaser__media_youtube_image';
  $file_display->weight = -99;
  $file_display->status = TRUE;
  $file_display->settings = array(
    'image_style' => 'thumbnail',
  );
  $file_displays['video__teaser__media_youtube_image'] = $file_display;

  
  return $file_displays;
}

function incubator_file_default_displays_alter(&$displays) {
  
  $displays['image__default__file_field_image']->settings['image_style'] = 'large';
  $displays['image__teaser__file_field_image']->settings['image_style'] = 'thumbnail';
  
  $displays['video__teaser__media_vimeo_video']->status = FALSE;
  $displays['video__teaser__media_youtube_video']->status = FALSE;
  
  $displays['video__default__file_field_file_video']->weight = 99;
  $displays['video__default__file_field_file_video']->settings['muted'] = 0;
  $displays['video__default__file_field_file_video']->settings['preload'] = '';
  
  $displays['video__teaser__file_field_file_video']->status = FALSE;

  foreach (array('default', 'media_large', 'media_original', 'media_small') as $display_name) {
    $displays["video__{$display_name}__media_vimeo_video"]->settings['title'] = 0;
    $displays["video__{$display_name}__media_vimeo_video"]->settings['byline'] = 0;
    $displays["video__{$display_name}__media_vimeo_video"]->settings['portrait'] = 0;
  
    $displays["video__{$display_name}__media_youtube_video"]->settings['related'] = 0;
    $displays["video__{$display_name}__media_youtube_video"]->settings['captions'] = '1';
    $displays["video__{$display_name}__media_youtube_video"]->settings['showinfo'] = 0;
    $displays["video__{$display_name}__media_youtube_video"]->settings['modestbranding'] = 1;
    $displays["video__{$display_name}__media_youtube_video"]->settings['rel'] = 0;
  }
}
