You are here

function geoip_language_mapping_create in GeoIP API 6

Same name and namespace in other branches
  1. 7 geoip_language/geoip_language.module \geoip_language_mapping_create()

API function to create a new mapping.

2 calls to geoip_language_mapping_create()
geoipLanguageTestCase::setUp in geoip_language/geoip_language.test
Implementation of setUp().
geoip_language_settings_form_submit in geoip_language/geoip_language.admin.inc
FAPI submit handler.

File

geoip_language/geoip_language.module, line 186
Language negotiation based on GeoIP detection.

Code

function geoip_language_mapping_create($country, $language) {
  $data = array(
    'country' => $country,
    'language' => $language,
  );
  drupal_write_record('geoip_language', $data);
  geoip_language_mappings(TRUE);
  $countries = geoip_country_values();
  watchdog('geoip_language', 'GeoIP mapping created for %country', array(
    '%country' => $countries[$country],
  ));
  return $data;
}