function countries_t in Countries 7.2
Same name and namespace in other branches
- 8 countries.module \countries_t()
Wrapper function to hook into the countries_i18n module.
4 calls to countries_t()
- CountriesCRUDUIUnitTest::testISO2Conflict in tests/
countries.test - Special case where the ISO matches an existing ISO code.
- countries_admin_form_validate in ./
countries.admin.inc - Validate country form submissions.
- countries_apachesolr_display_callback in ./
countries.module - Returns the country name to be used in the facet.
- countries_apachesolr_map_callback in ./
countries.module - Map callback.
File
- ./
countries.module, line 133 - Defines the field and entity information for countries.
Code
function countries_t($country, $property = 'name', $langcode = NULL, $type = 'country') {
static $i18n = NULL;
if (!isset($i18n)) {
$i18n = module_exists('countries_i18n');
}
switch ($property) {
case 'name':
$value = $country->name;
break;
case 'official_name':
$value = empty($country->official_name) ? '' : $country->official_name;
break;
default:
return isset($country->{$property}) ? $country->{$property} : '';
}
return $i18n ? countries_i18n_translate($country->iso2, $property, $value, $langcode, $type) : $value;
}