function media_gallery_update_7010 in Media Gallery 7.2
Same name and namespace in other branches
- 7 media_gallery.install \media_gallery_update_7010()
Configure galleries to allow audio.
File
- ./
media_gallery.install, line 1289 - Install file for media_gallery. Includes field and instance definitions.
Code
function media_gallery_update_7010() {
drupal_load('module', 'field');
$bundle = 'audio';
// Enable audio for the node's media_gallery field.
if ($instance = field_info_instance('node', 'media_gallery_media', 'media_gallery')) {
$instance['widget']['settings']['allowed_types'][$bundle] = $bundle;
field_update_instance($instance);
}
// Enable gallery view modes for audio entities.
$bundle_settings = field_bundle_settings('file', $bundle);
foreach (array(
'media_gallery_thumbnail',
'media_gallery_lightbox',
'media_gallery_detail',
'media_gallery_block_thumbnail',
'media_gallery_collection_thumbnail',
) as $view_mode) {
$bundle_settings['view_modes'][$view_mode]['custom_settings'] = TRUE;
}
field_bundle_settings('file', $bundle, $bundle_settings);
}