Commit 0640b76d authored by KarenS's avatar KarenS
Browse files

#781088 More work on content migrate. Fix allowed values to make them into...

#781088 More work on content migrate. Fix allowed values to make them into arrays, to match the new way that lists are stored.
parent 59ea776a
......@@ -337,6 +337,22 @@ function content_migrate_content_migrate_field_alter(&$field_value) {
if (empty($field_value['settings']['max_length'])) {
$field_value['settings']['max_length'] = 255;
}
// The allowed values list should now be stored as an array.
$allowed_values = array();
if (!empty($field_value['settings']['allowed_values'])) {
$allowed_values;
foreach (explode("\n", $field_value['settings']['allowed_values']) as $value) {
if (empty($value)) continue;
if (strstr($value, '|')) {
$parts = explode('|', $value);
$allowed_values[trim($parts[0])] = trim($parts[1]);
}
else {
$allowed_values[] = trim($value);
}
}
}
// Text fields using optionwidgets are
// now List fields.
......@@ -345,10 +361,12 @@ function content_migrate_content_migrate_field_alter(&$field_value) {
case 'optionwidgets_select':
$field_value['type'] = 'list_text';
$field_value['module'] = 'list';
$field_value['settings']['allowed_values'] = $allowed_values;
break;
case 'optionwidgets_onoff':
$field_value['type'] = 'list_boolean';
$field_value['module'] = 'list';
$field_value['settings']['allowed_values'] = $allowed_values;
break;
case 'text_textarea':
$field_value['type'] = 'text_long';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment