function file_force_update_7000 in File Force Download 7
Update as many formatter information as possible to the new D7 system.
File
- ./
file_force.install, line 20
Code
function file_force_update_7000() {
// Iterate through all field instances and update those that have a formatter set by module 'file_force'
$entity_instances = field_info_instances();
foreach ($entity_instances['node'] as $entity_name => $instances) {
foreach ($instances as $name => $instance) {
foreach ($instance['display'] as $view_mode => $display_settings) {
if ($display_settings['module'] == 'file_force') {
switch ($instance['display'][$view_mode]['type']) {
// Update the names of the file fields to the new convention
case 'default_ff':
$instance['display'][$view_mode]['type'] = 'file_force_file_default';
break;
case 'url_plain_ff':
$instance['display'][$view_mode]['type'] = 'file_force_file_url_plain';
break;
// Update the names of the image fields and set the correct settings
case 'image_imagelink_ff':
$instance['display'][$view_mode]['type'] = 'file_force_image';
$instance['display'][$view_mode]['settings'] = array(
'image_style' => '',
);
break;
// Update the names of the old imagecache fields and set the correct settings
default:
$style = substr($instance['display'][$view_mode]['type'], 0, -13);
$instance['display'][$view_mode]['type'] = 'file_force_image';
$instance['display'][$view_mode]['settings'] = array(
'image_style' => $style,
);
break;
}
}
}
field_update_instance($instance);
}
}
}