Commit 57a78f13 authored by KarenS's avatar KarenS
Browse files

#1039466 by yched, Don't clobber formatter settings provided by third party modules.

parent 70de9852
......@@ -44,26 +44,24 @@ function content_migrate_number_field_alter(&$field_value, $instance_value) {
case 'optionwidgets_onoff':
$field_value['type'] = 'list_boolean';
$field_value['module'] = 'list';
break;
break;
}
break;
break;
}
}
/**
* Implements hook_content_migrate_instance_alter().
*
*
* Use this to tweak the conversion of instance or widget settings
* from the D6 style to the D7 style for specific
* situations not handled by basic conversion, as when
* formatter or widget names or settings are changed.
*/
function content_migrate_number_instance_alter(&$instance_value, $field_value) {
// Switch
switch ($instance_value['widget']['module']) {
case 'number':
switch ($field_value['module']) {
case 'number':
// The number formatters and formatter settings
// have changed.
$new_type = array(
......@@ -139,13 +137,15 @@ function content_migrate_number_instance_alter(&$instance_value, $field_value) {
'decimal_separator' => ', ',
'scale' => 2,
'prefix_suffix' => TRUE,
),
),
);
foreach ($instance_value['display'] as $context => $settings) {
$instance_value['display'][$context]['type'] = $new_type[$settings['type']];
$instance_value['display'][$context]['settings'] = $new_settings[$settings['type']];
if ($settings['module'] == 'number') {
$instance_value['display'][$context]['type'] = $new_type[$settings['type']];
$instance_value['display'][$context]['settings'] = $new_settings[$settings['type']];
}
}
break;
}
}
......@@ -69,23 +69,23 @@ function content_migrate_text_field_alter(&$field_value, $instance_value) {
/**
* Implements hook_content_migrate_instance_alter().
*
*
* Use this to tweak the conversion of instance or widget settings
* from the D6 style to the D7 style for specific
* situations not handled by basic conversion, as when
* formatter or widget names or settings are changed.
*/
function content_migrate_text_instance_alter(&$instance_value, $field_value) {
// Switch
switch ($instance_value['widget']['module']) {
switch ($field_value['module']) {
case 'text':
// The formatter names changed, all are prefixed
// with 'text_'.
foreach ($instance_value['display'] as $context => $settings) {
$instance_value['display'][$context]['type'] = 'text_'. $settings['type'];
}
if ($settings['module'] == 'text') {
$instance_value['display'][$context]['type'] = 'text_'. $settings['type'];
}
}
break;
}
}
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