Commit 6b1551d8 authored by KarenS's avatar KarenS
Browse files

Add content_migrate hook implementations to node_reference and user_reference.

parent 8376bb8b
......@@ -680,3 +680,57 @@ function node_reference_options_list($field) {
}
return $options;
}
/**
* 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.
*
* $field_value['widget_type'] is available to
* see what widget type was originally used.
*/
function node_reference_content_migrate_field_alter(&$field_value) {
switch ($field_value['module']) {
case 'nodereference':
$field_value['module'] = 'node_reference';
$field_value['type'] = 'node_reference';
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 node_reference_content_migrate_instance_alter(&$instance_value) {
// The module name for the instance was corrected
// by the change in node_reference_content_migrate_field_alter().
switch ($instance_value['module']) {
case 'node_reference':
// The formatter names changed, all are prefixed
// with 'node_reference_'.
foreach ($instance_value['display'] as $context => $settings) {
$instance_value['display'][$context]['type'] = 'node_reference_'. $settings['type'];
}
switch ($instance_value['widget']['type']) {
case 'nodereference_autocomplete':
$instance_value['widget']['type'] = 'node_reference_autocomplete';
break;
case 'nodereference_select':
$instance_value['widget']['type'] = 'options_select';
$instance_value['widget']['module'] = 'options';
break;
case 'nodereference_buttons':
$instance_value['widget']['type'] = 'options_buttons';
$instance_value['widget']['module'] = 'options';
}
break;
}
}
\ No newline at end of file
......@@ -601,3 +601,57 @@ function user_reference_options_list($field) {
}
}
}*/
/**
* 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.
*
* $field_value['widget_type'] is available to
* see what widget type was originally used.
*/
function user_reference_content_migrate_field_alter(&$field_value) {
switch ($field_value['module']) {
case 'userreference':
$field_value['module'] = 'user_reference';
$field_value['type'] = 'user_reference';
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 user_reference_content_migrate_instance_alter(&$instance_value) {
// The module name for the instance was corrected
// by the change in user_reference_content_migrate_field_alter().
switch ($instance_value['module']) {
case 'user_reference':
// The formatter names changed, all are prefixed
// with 'user_reference_'.
foreach ($instance_value['display'] as $context => $settings) {
$instance_value['display'][$context]['type'] = 'user_reference_'. $settings['type'];
}
switch ($instance_value['widget']['type']) {
case 'userreference_autocomplete':
$instance_value['widget']['type'] = 'user_reference_autocomplete';
break;
case 'userreference_select':
$instance_value['widget']['type'] = 'options_select';
$instance_value['widget']['module'] = 'options';
break;
case 'userreference_buttons':
$instance_value['widget']['type'] = 'options_buttons';
$instance_value['widget']['module'] = 'options';
}
break;
}
}
\ No newline at end of file
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