You are here

imagecache_proportions.install in Imagecache Proportions 7

Contains update functions for Imagecache proportions.

File

imagecache_proportions.install
View source
<?php

/**
 * @file
 * Contains update functions for Imagecache proportions.
 */

/**
 * Update shadowbox and colorbox settings in order to improve integration.
 */
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');
}

Functions

Namesort descending Description
imagecache_proportions_update_7101 Update shadowbox and colorbox settings in order to improve integration.