function file_content_migrate_field_alter in Content Construction Kit (CCK) 7.3
Implements hook_content_migrate_field_alter().
Use this to tweak the conversion of field settings from the D6 style to the D7 style for specific situations not handled by basic conversion, as when field types or settings are changed.
File
- modules/
content_migrate/ modules/ content_migrate.file.inc, line 15 - content_migrate.file.inc Code to implement Content Migrate hooks on behalf of the File module.
Code
function file_content_migrate_field_alter(&$field_value, $instance_value) {
// There are a bunch of custom imagefield widgets. If they at least start the widget name with 'imagefield' this will work.
if (substr($instance_value['widget']['type'], 0, 10) == 'imagefield') {
// Module names and types changed.
$field_value['messages'][] = t("Changed field type: The '@field' field type will be changed from '@type' to 'image'.", array(
'@type' => $field_value['type'],
'@field' => $field_value['field_name'],
'@widget' => $instance_value['widget']['type'],
));
$field_value['module'] = 'image';
$field_value['type'] = 'image';
// default_image is now a field setting.
if (array_key_exists('default_image', $instance_value['widget']['settings'])) {
$field_value['settings']['default_image'] = $instance_value['widget']['settings']['default_image'];
}
}
// There are a bunch of custom filefield widgets. If they at least start the widget name with 'filefield' this will work.
if (substr($instance_value['widget']['type'], 0, 9) == 'filefield') {
// Module names and types changed.
$field_value['messages'][] = t("Changed field type: The '@field' field type will be changed from '@type' to 'file'.", array(
'@type' => $field_value['type'],
'@field' => $field_value['field_name'],
'@widget' => $instance_value['widget']['type'],
));
$field_value['module'] = 'file';
$field_value['type'] = 'file';
// Some settings have changed names.
if (array_key_exists('list_field', $field_value['settings'])) {
$field_value['settings']['display_field'] = $field_value['settings']['list_field'];
unset($field_value['settings']['list_field']);
}
$field_value['settings']['display_default'] = $field_value['settings']['list_default'];
unset($field_value['settings']['list_default']);
}
}