diff --git a/addressfield.administrative_areas.inc b/addressfield.administrative_areas.inc index 88343de..e6df046 100644 --- a/addressfield.administrative_areas.inc +++ b/addressfield.administrative_areas.inc @@ -11,7 +11,24 @@ * NULL if not found. */ function addressfield_get_administrative_areas($country_code) { - $administrative_areas = array(); + // Get the default administrative areas. + $administrative_areas = _addressfield_get_administrative_areas_defaults(); + + // Allow other modules to alter the administrative areas. + drupal_alter('addressfield_administrative_areas', $administrative_areas); + + return isset($administrative_areas[$country_code]) ? $administrative_areas[$country_code] : null; +} + +/** + * Helper to load the default administrative areas. + */ +function _addressfield_get_administrative_areas_defaults() { + $administrative_areas = &drupal_static(__FUNCTION__, array()); + if ($administrative_areas) { + return $administrative_areas; + } + $administrative_areas['AE'] = array( 'AZ' => t('Abu Dhabi'), 'FU' => t('Fujairah'), @@ -536,20 +553,20 @@ function addressfield_get_administrative_areas($country_code) { 'VV' => t('Vibo Valentia'), ); $administrative_areas['JM'] = array( - '13' => 'Clarendon', - '09' => 'Hanover', - '01' => 'Kingston', - '12' => 'Manchester', - '04' => 'Portland', - '02' => 'St. Andrew', - '06' => 'St. Ann', - '14' => 'St. Catherine', - '11' => 'St. Elizabeth', - '08' => 'St. James', - '05' => 'St. Mary', - '03' => 'St. Thomas', - '07' => 'Trelawny', - '10' => 'Westmoreland', + '13' => t('Clarendon'), + '09' => t('Hanover'), + '01' => t('Kingston'), + '12' => t('Manchester'), + '04' => t('Portland'), + '02' => t('St. Andrew'), + '06' => t('St. Ann'), + '14' => t('St. Catherine'), + '11' => t('St. Elizabeth'), + '08' => t('St. James'), + '05' => t('St. Mary'), + '03' => t('St. Thomas'), + '07' => t('Trelawny'), + '10' => t('Westmoreland'), ); $administrative_areas['JP'] = array( '01' => t('Hokkaido'), @@ -1030,8 +1047,5 @@ function addressfield_get_administrative_areas($country_code) { 'V' => t('Zulia'), ); - // Allow other modules to alter the administrative areas. - drupal_alter('addressfield_administrative_areas', $administrative_areas); - - return isset($administrative_areas[$country_code]) ? $administrative_areas[$country_code] : null; + return $administrative_areas; }