Commit d351e4a2 authored by Karen Stevenson's avatar Karen Stevenson
Browse files

Did some clean up of the List test and reverted the code that tried to check...

Did some clean up of the List test and reverted the code that tried to check the module name for formatters, because it doesn't work.
parent 57a78f13
......@@ -164,6 +164,7 @@ function _content_migrate_get_instance_values($bundle = NULL, $field_name = NULL
$instance_value['display'][$context]['type'] = $settings['format'];
$instance_value['display'][$context]['settings'] = field_info_formatter_settings($settings['format']);
$instance_value['display'][$context]['weight'] = $instance_value['weight'];
$instance_value['display'][$context]['module'] = $instance_value['widget_module'];
}
......
......@@ -38,7 +38,12 @@ function content_migrate_number_field_alter(&$field_value, $instance_value) {
switch ($instance_value['widget']['type']) {
case 'optionwidgets_buttons':
case 'optionwidgets_select':
$field_value['type'] = 'list_number';
if ($field_value['type'] == 'number_integer') {
$field_value['type'] = 'list_integer';
}
else {
$field_value['type'] = 'list_float';
}
$field_value['module'] = 'list';
break;
case 'optionwidgets_onoff':
......@@ -140,10 +145,8 @@ function content_migrate_number_instance_alter(&$instance_value, $field_value) {
),
);
foreach ($instance_value['display'] as $context => $settings) {
if ($settings['module'] == 'number') {
$instance_value['display'][$context]['type'] = $new_type[$settings['type']];
$instance_value['display'][$context]['settings'] = $new_settings[$settings['type']];
}
$instance_value['display'][$context]['type'] = $new_type[$settings['type']];
$instance_value['display'][$context]['settings'] = $new_settings[$settings['type']];
}
break;
}
......
......@@ -81,9 +81,7 @@ function content_migrate_text_instance_alter(&$instance_value, $field_value) {
// The formatter names changed, all are prefixed
// with 'text_'.
foreach ($instance_value['display'] as $context => $settings) {
if ($settings['module'] == 'text') {
$instance_value['display'][$context]['type'] = 'text_'. $settings['type'];
}
$instance_value['display'][$context]['type'] = 'text_'. $settings['type'];
}
break;
}
......
......@@ -564,13 +564,13 @@ class ContentMigrateListTestCase extends ContentMigrateTestCase {
// We need a field to migrate.
$values = array();
for ($i = 0; $i < 5; $i++) {
$val = array('value' => $this->randomName(10));
$values[$val] = $val;
$val = $this->randomName(10);
$values['value'][$val] = $val;
if ($i == 0) {
$default = $val;
$default = array('value' => $val);
}
else if ($i == 2) {
$data = $val;
$data = array('value' => $val);
}
}
$test_field = $this->setupField('text', 'optionwidgets_select', 0, 0, $default, $values);
......
Supports Markdown
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