You are here

function _phone_update_phone_country in Phone 7.2

Helper function for migrate/update functions: convert phone-6.x and phone-7.x-1.x country specification to new value.

2 calls to _phone_update_phone_country()
phone_content_migrate_instance_alter in ./phone.content_migrate.inc
Implements hook_content_migrate_instance_alter().
phone_update_7200 in ./phone.install

File

./phone.module, line 1238
The phone module lets administrators use a phone number field type.

Code

function _phone_update_phone_country($orig_country) {
  if ($orig_country == 'int') {

    // If 'internaional' was used, set new default country based on
    // site's country.
    return variable_get('site_default_country', 'US');
  }
  else {
    $country = drupal_strtoupper($orig_country);

    // Fix the country code as necessary.
    switch ($country) {

      // Change 'ca' to 'us' because it's far more likely that's what the
      // user wanted.
      case 'CA':
        $country = 'US';
        break;

      // Greece is GR, not EL
      case 'EL':
        $country = 'GR';
        break;

      // Czech Republic is CZ, not CS
      case 'CS':
        $country = 'CZ';
        break;
    }
    return $country;
  }
}