You are here

function blockreference_content_migrate_instance_alter in Block reference 7

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

./blockreference.module, line 697
Defines a field type for referencing a block from a node.

Code

function blockreference_content_migrate_instance_alter(&$instance_value) {

  // The module name for the instance was corrected
  // by the change in blockreference_content_migrate_field_alter().
  if (isset($instance_value['module']) && $instance_value['module'] == 'blockreference') {

    // The formatter names changed, all are prefixed
    // with 'blockreference_'.
    foreach ($instance_value['display'] as $context => $settings) {
      $instance_value['display'][$context]['type'] = 'blockreference_' . $settings['type'];
    }
    switch ($instance_value['widget']['type']) {
      case 'blockreference_autocomplete':
        $instance_value['widget']['type'] = 'blockreference_autocomplete';
        $instance_value['widget']['module'] = 'blockreference';
        break;
      case 'blockreference_select':
        $instance_value['widget']['type'] = 'options_select';
        $instance_value['widget']['module'] = 'options';
        break;
      case 'blockreference_buttons':
        $instance_value['widget']['type'] = 'options_buttons';
        $instance_value['widget']['module'] = 'options';
    }
  }
}