public function CRMCoreConversionHandler::countryCode in CRM Core 7
Returns country code for country name.
1 call to CRMCoreConversionHandler::countryCode()
- CiviCrmCoreFields::prepareRow in modules/
crm_core_data_import/ plugins/ conversion/ CiviCrmCoreFields.inc - Process row of data.
File
- modules/
crm_core_data_import/ plugins/ conversion/ CRMCoreConversionHandler.inc, line 34 - Default conversion handler for CRM Core Data Import.
Class
- CRMCoreConversionHandler
- @file Default conversion handler for CRM Core Data Import.
Code
public function countryCode($country_name) {
include_once DRUPAL_ROOT . '/includes/locale.inc';
$countries = country_get_list();
if ($country_code = array_search($country_name, $countries)) {
return $country_code;
}
else {
return $country_name;
}
}