function media_gallery_update_7005 in Media Gallery 7
Same name and namespace in other branches
- 7.2 media_gallery.install \media_gallery_update_7005()
There was an odd case where galleries created previous to youtube support lost some display settings on update. This update fixes those display settings.
File
- ./
media_gallery.install, line 1124 - Install file for media_gallery. Includes field and instance definitions.
Code
function media_gallery_update_7005() {
// Ensure that the media_description field has the proper label
foreach (array(
'video',
'image',
) as $bundle) {
$instance = field_info_instance('media', 'media_description', $bundle);
if ($instance) {
$instance['label'] = t('Description');
field_update_instance($instance);
}
}
// Ensure that media videos have the proper display formatters
$instance = field_info_instance('media', 'file', 'video');
if ($instance) {
$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);
}
// Remove the old add_images_link extra field if it still exists
$bundle_settings = field_bundle_settings('node', 'media_gallery');
unset($bundle_settings['extra_fields']['display']['add_images_link']);
$bundle_settings['extra_fields']['display']['add_media_link']['full']['weight'] = 1;
$bundle_settings['extra_fields']['display']['add_media_link']['full']['visible'] = TRUE;
$bundle_settings['extra_fields']['display']['add_media_link']['default']['visible'] = FALSE;
$bundle_settings['extra_fields']['display']['add_media_link']['teaser']['visible'] = FALSE;
$bundle_settings['extra_fields']['display']['add_media_link']['media_gallery_block']['visible'] = FALSE;
field_bundle_settings('node', 'media_gallery', $bundle_settings);
}