function countries_get_continents in Countries 8
Same name and namespace in other branches
- 7.2 countries.module \countries_get_continents()
- 7 countries.module \countries_get_continents()
Gets a list of all continents currently enabled.
Note that it is possible to have continent codes that are not present in this array if the user has overridden the variable setting "countries_continents".
Return value
array An array of continents indexed by their continent code.
See also
countries_get_default_continents()
7 calls to countries_get_continents()
- countries_admin_form in ./
countries.admin.inc - Generate a country form.
- countries_field_widget_form in ./
countries.fields.inc - Implements hook_field_widget_form().
- countries_filter_options_form in ./
countries.fields.inc - Wrapper for the filter form options that are shared with other fields.
- country_property in ./
countries.module - Helper function to help standardise the display of the core properties.
- views_handler_field_countries_continent::render in views/
views_handler_field_countries_continent.inc - Render contient as human readable name or continent code
2 string references to 'countries_get_continents'
- countries_clear_caches in ./
countries.module - Helper function to clear various caches.
- countries_views_data in views/
countries.views.inc - Implements hook_views_data().
File
- ./
countries.module, line 459 - Defines the field and entity information for countries.
Code
function countries_get_continents($t_options = array()) {
$continents =& drupal_static(__FUNCTION__, array());
global $language;
$langcode = empty($t_options['langcode']) ? $language->language : $t_options['langcode'];
if (empty($continents[$langcode])) {
$continents[$langcode] = variable_get('countries_continents', countries_get_default_continents($t_options));
$known = countries_known_continents($t_options);
$continents[$langcode] = array_intersect_key($known, $continents[$langcode]) + array_diff_key($continents[$langcode], $known);
uasort($continents[$langcode], 'countries_sort');
}
return $continents[$langcode];
}