function addressfield_get_administrative_areas in Address Field 7
Returns the predefined administrative areas.
Parameters
$country_code: The country code for which administrative areas should be returned.
Return value
An array of predefined administrative areas for the given country code, or NULL if not found.
2 calls to addressfield_get_administrative_areas()
- addressfield_format_address_generate in plugins/
format/ address.inc - Format callback.
- addressfield_views_handler_field_administrative_area::get_value in views/
addressfield_views_handler_field_administrative_area.inc - Get the value that's supposed to be rendered.
File
- ./
addressfield.administrative_areas.inc, line 13
Code
function addressfield_get_administrative_areas($country_code) {
// Maintain a static cache to avoid passing the administrative areas through
// t() more than once per request.
$administrative_areas =& drupal_static(__FUNCTION__, array());
if (empty($administrative_areas)) {
// 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;
}