You are here

function imagecache_proportions_update_7101 in Imagecache Proportions 7

Update shadowbox and colorbox settings in order to improve integration.

File

./imagecache_proportions.install, line 11
Contains update functions for Imagecache proportions.

Code

function imagecache_proportions_update_7101() {
  $all_instances = field_info_instances();
  foreach ($all_instances as $entity_type => $bundle) {
    foreach ($bundle as $name => $instances) {
      foreach ($instances as $instance) {
        $update_instance = FALSE;
        foreach ($instance['display'] as $display_name => $display) {
          if ($display['type'] == 'vertical_horizontal') {
            if ($display['settings']['enable_link'] == 'colorbox') {
              $instance['display'][$display_name]['settings']['colorbox'] = array(
                'colorbox_image_style' => $display['settings']['modal_style'],
                'colorbox_gallery' => 'post',
                'colorbox_gallery_custom' => '',
                'colorbox_caption' => 'auto',
                'colorbox_caption_custom' => '',
              );
              unset($display['settings']['modal_style']);
              $update_instance = TRUE;
            }
            elseif ($display['settings']['enable_link'] == 'shadowbox') {
              $instance['display'][$display_name]['settings']['shadowbox'] = array(
                'image_link' => $display['settings']['modal_style'],
                'gallery' => '',
                'compact' => '',
                'title' => '',
              );
              unset($display['settings']['modal_style']);
              $update_instance = TRUE;
            }
          }
        }
        if ($update_instance) {
          field_update_instance($instance);
        }
      }
    }
  }
  return t('Field placeholder maintenance tasks finished');
}