You are here

function countries_country_expand in Countries 7

Same name and namespace in other branches
  1. 8 countries.module \countries_country_expand()
  2. 7.2 countries.module \countries_country_expand()

Our process callback to expand the control.

1 string reference to 'countries_country_expand'
countries_element_info in ./countries.module
Implement hook_element_info().

File

./countries.module, line 220

Code

function countries_country_expand($element) {
  if (empty($element['#options'])) {
    if (empty($element['#filters'])) {
      include_once DRUPAL_ROOT . '/includes/locale.inc';
      $element['#options'] = country_get_list();
    }
    else {
      $element['#options'] = countries_get_countries('name');
    }
  }
  $element['#options'] = countries_filter($element['#options'], $element['#filters']);

  // If not required, add a none option. This can be overridden via setting
  // the $element['#empty_value'] parameter to NULL.
  if (empty($element['#required']) && !isset($element['#empty_value'])) {
    $element['#empty_value'] = '';
  }
  return $element;
}