You are here

function language_negotiation_get in Drupal 7

Checks whether a language negotiation provider is enabled for a language type.

This has two possible behaviors:

  • If $provider_id is given return its ID if enabled, FALSE otherwise.
  • If no ID is passed the first enabled language negotiation provider is returned.

Parameters

$type: The language negotiation provider type.

$provider_id: The language negotiation provider ID.

Return value

The provider ID if it is enabled, FALSE otherwise.

Related topics

3 calls to language_negotiation_get()
language_negotiation_get_any in includes/language.inc
Checks if the language negotiation provider is enabled for any language type.
LocaleUninstallFunctionalTest::testUninstallProcess in modules/locale/locale.test
Check if the values of the Locale variables are correct after uninstall.
locale_language_selector_form in modules/locale/locale.module
Form builder callback to display language selection widget.

File

includes/language.inc, line 230
Language Negotiation API.

Code

function language_negotiation_get($type, $provider_id = NULL) {
  $negotiation = variable_get("language_negotiation_{$type}", array());
  if (empty($negotiation)) {
    return empty($provider_id) ? LANGUAGE_NEGOTIATION_DEFAULT : FALSE;
  }
  if (empty($provider_id)) {
    return key($negotiation);
  }
  if (isset($negotiation[$provider_id])) {
    return $provider_id;
  }
  return FALSE;
}