Code in profile_migrate_fields():
1) Initialize $new_fields = array();
2) Truncate $field_name = substr(strtolower(strtr($old_field->name, $replace)), 0, 32); // CCK only allows 32 characters.
3) If errors occur in field creation batch process and it needs to be rerun and not create duplicate fields, then replace:
while (in_array($field_name, $all_fields)) {
$field_name .= '_1';
}
by:
if (in_array($field_name, $all_fields)) {
$new_fields[$old_field->name] = $field_name;
continue;
}
4) Selection field should convert to optionwidget:
case 'selection':
$field['type'] = 'text';
$field['module'] = 'text';
$field['widget']['type'] = 'optionwidgets_select'; // 'options_select';
$field['widget']['module'] = 'optionwidgets'; // 'text';
Comments
Comment #1
rares commentedAlso, this line:
drupal_set_message(t('The @module module must be enabled before these fields can be migrated.'), 'error');
should be
drupal_set_message(t('The @module module must be enabled before these fields can be migrated.', array('@module'=>$module)), 'error');
and this section
$replace_name = array(
' ' => '_',
);
should be expanded to include '(' => '' and ')' => '' as well as other characters which are unsupported in table names.
Comment #2
jwilson3item #4 from OP detailed and patched here: #671514: Values from selection profiles fields are not visible and here: #874226: select lists dont appear after conversion.
Also, the issue brought up in comment #1 is covered in #692888: Settings form: missing module message does not display, with a patch provided in comment #3.
Comment #3
jwilson3It would be nice to expose OP issue #3 as an optional setting in the admin settings page via a checkbox.
[ ] Overwrite existing fields.
If an existing content type and field name are encountered during the conversion, update the existing field's definitions.
This would require a bit of extra checking as I believe the code provided above may be destructive, if you happen to already have an existing field on a completely different content type, it would still overwrite that definition. If I get some extra time i'll try to write a patch.
Comment #4
jwilson3--deleted-- duplicate info