You are here

function geoip_language_settings_form in GeoIP API 7

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

FAPI callback for creating a new country-language mapping.

Return value

array

1 string reference to 'geoip_language_settings_form'
geoip_language_settings_overview in geoip_language/geoip_language.admin.inc
Create the overview table of the already existing mappgins

File

geoip_language/geoip_language.admin.inc, line 55
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;
}