You are here

function tzfield_content_migrate_instance_alter in Time Zone Field 7

Implements hook_content_migrate_instance_alter().

File

./tzfield.module, line 275
Defines a time zone field type.

Code

function tzfield_content_migrate_instance_alter(&$instance) {

  // Select widget now provided by options module.
  if ($instance['widget_type'] == 'tzfield_select') {
    $instance['widget_type'] = 'options_select';
    $instance['widget']['type'] = 'options_select';
    $instance['widget']['module'] = 'options';
  }

  // Use new date formatter.
  $formats = array(
    'abbreviation' => 'T',
    'medium' => variable_get('date_format_medium', 'D, m/d/Y - H:i'),
    'rfc2822' => 'r',
  );
  foreach ($instance['display'] as $view_mode => $display) {
    if ($display['module'] == 'tzfield' && isset($formats[$display['type']])) {
      $instance['display'][$view_mode]['type'] = 'tzfield_date';
      $instance['display'][$view_mode]['settings']['format'] = $formats[$display['type']];
    }
  }
}