You are here

function picture_update_7002 in Picture 7

Update field formatters to the new colorbox settings.

File

./picture.install, line 79
Install/schema hooks for the picture module.

Code

function picture_update_7002() {
  $fields = field_read_fields(array(
    'type' => 'image',
  ));
  foreach ($fields as $field) {
    $instances = field_read_instances(array(
      'field_id' => $field['id'],
    ));
    foreach ($instances as $instance) {
      foreach ($instance['display'] as $view_mode => $view_mode_settings) {
        if ($view_mode_settings['type'] == 'picture') {
          $colorbox_group = $instance['display'][$view_mode]['settings']['colorbox'];
          $instance['display'][$view_mode]['settings']['colorbox_settings'] = array(
            'colorbox_group' => $colorbox_group,
            'colorbox_gallery' => 'none',
            'colorbox_gallery_custom' => '',
            'colorbox_caption' => 'none',
            'colorbox_caption_custom' => '',
            'colorbox_multivalue_index' => NULL,
          );
        }
      }
      field_update_instance($instance);
    }
  }
}