diff --git a/media_gallery.fields.inc b/media_gallery.fields.inc index 54448ac..077b3d8 100644 --- a/media_gallery.fields.inc +++ b/media_gallery.fields.inc @@ -13,23 +13,23 @@ function media_gallery_field_formatter_info() { return array( 'media_gallery_thumbnail' => array( 'label' => t('Gallery thumbnail'), - 'field types' => array('media'), + 'field types' => array('file'), ), 'media_gallery_lightbox' => array( 'label' => t('Gallery lightbox'), - 'field types' => array('media'), + 'field types' => array('file'), ), 'media_gallery_detail' => array( 'label' => t('Gallery detail'), - 'field types' => array('media'), + 'field types' => array('file'), ), 'media_gallery_block_thumbnail' => array( 'label' => t('Block thumbnail'), - 'field types' => array('media'), + 'field types' => array('file'), ), 'media_gallery_collection_thumbnail' => array( 'label' => t('Collection thumbnail'), - 'field types' => array('media'), + 'field types' => array('file'), ), ); } diff --git a/media_gallery.install b/media_gallery.install index c3d7123..1a5873f 100644 --- a/media_gallery.install +++ b/media_gallery.install @@ -50,20 +50,13 @@ function media_gallery_install() { // instances in media entity bundles. // @todo Add a hook_update() function for 'video'. foreach (array('image', 'video') as $bundle) { - $bundle_settings = field_bundle_settings('media', $bundle); + $bundle_settings = field_bundle_settings('file', $bundle); $bundle_settings['view_modes']['media_gallery_thumbnail']['custom_settings'] = TRUE; $bundle_settings['view_modes']['media_gallery_lightbox']['custom_settings'] = TRUE; $bundle_settings['view_modes']['media_gallery_detail']['custom_settings'] = TRUE; $bundle_settings['view_modes']['media_gallery_block_thumbnail']['custom_settings'] = TRUE; $bundle_settings['view_modes']['media_gallery_collection_thumbnail']['custom_settings'] = TRUE; - field_bundle_settings('media', $bundle, $bundle_settings); - $instance = field_info_instance('media', 'file', $bundle); - $instance['display']['media_gallery_thumbnail'] = array('type' => 'styles_file_media_gallery_thumbnail', 'label' => 'hidden'); - $instance['display']['media_gallery_lightbox'] = array('type' => 'styles_file_media_gallery_large', 'label' => 'hidden'); - $instance['display']['media_gallery_detail'] = array('type' => 'styles_file_media_gallery_large', 'label' => 'hidden'); - $instance['display']['media_gallery_block_thumbnail'] = array('type' => 'styles_file_media_gallery_thumbnail', 'label' => 'hidden'); - $instance['display']['media_gallery_collection_thumbnail'] = array('type' => 'styles_file_media_gallery_thumbnail', 'label' => 'hidden'); - field_update_instance($instance); + field_bundle_settings('file', $bundle, $bundle_settings); } // Clear caches so that our implementation of hook_image_default_styles() is diff --git a/media_gallery.module b/media_gallery.module index d6e0ff5..5a424a2 100644 --- a/media_gallery.module +++ b/media_gallery.module @@ -794,11 +794,11 @@ function media_gallery_remove_item_from_gallery($node, $media) { * Implements hook_entity_info_alter(). */ function media_gallery_entity_info_alter(&$info) { - // For each media field formatter we add, we also need to add the - // corresponding media entity view mode. + // For each file field formatter we add, we also need to add the + // corresponding file entity view mode. foreach (media_gallery_field_formatter_info() as $formatter_name => $formatter_info) { - if (in_array('media', $formatter_info['field types'])) { - $info['media']['view modes'][$formatter_name] = array('label' => $formatter_info['label'], 'custom settings' => FALSE); + if (in_array('file', $formatter_info['field types'])) { + $info['file']['view modes'][$formatter_name] = array('label' => $formatter_info['label'], 'custom settings' => FALSE); } } // Add a view mode for displaying a node in a media gallery block.