You are here

function geoip_language_settings_form in GeoIP API 6

Same name and namespace in other branches
  1. 7 geoip_language/geoip_language.admin.inc \geoip_language_settings_form()

FAPI callback for creating a new country-language mapping.

1 string reference to 'geoip_language_settings_form'
geoip_language_settings_overview in geoip_language/geoip_language.admin.inc
Menu callback for admin/settings/language/geoip

File

geoip_language/geoip_language.admin.inc, line 49
Admin page callbacks for the GeoIP Language module.

Code

function geoip_language_settings_form() {
  $countries = geoip_country_values();
  $mapping = geoip_language_mappings();
  $options = array();
  foreach ($countries as $key => $value) {
    if (!$mapping[$key]) {
      $options[$key] = "{$key} - {$value}";
    }
  }
  $form['new'] = array(
    '#type' => 'fieldset',
    '#title' => t('New mapping'),
    '#tree' => 0,
  );
  $form['new']['country'] = array(
    '#type' => 'select',
    '#title' => t('Detected country'),
    '#options' => $options,
  );
  $form['new']['language'] = array(
    '#type' => 'select',
    '#title' => t('Language'),
    '#options' => locale_language_list('name', TRUE),
  );
  $form['new']['buttons'] = array();
  $form['new']['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add mapping'),
  );
  return $form;
}