function user_reference_content_migrate_instance_alter in References 7.2
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.
File
- user_reference/
user_reference.module, line 1129 - Defines a field type for referencing a user from a node.
Code
function user_reference_content_migrate_instance_alter(&$instance_value, $field_value) {
// The module name for the instance was corrected
// by the change in user_reference_content_migrate_field_alter().
switch ($field_value['type']) {
case 'userreference':
// 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'];
}
// Massage the widget.
switch ($instance_value['widget']['type']) {
case 'userreference_autocomplete':
$instance_value['widget']['type'] = 'user_reference_autocomplete';
$instance_value['widget']['module'] = 'user_reference';
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;
}
}