function language_negotiation_method_enabled

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

Parameters

$method_id: The language negotiation method ID.

$type: (optional) The language type. If none is passed, all the configurable language types will be inspected.

Return value

TRUE if the method is enabled for at least one of the given language types, or FALSE otherwise.

Related topics

2 calls to language_negotiation_method_enabled()
language_from_url in drupal/core/modules/language/language.negotiation.inc
Identify language via URL prefix or domain.
language_url_rewrite_session in drupal/core/modules/language/language.negotiation.inc
Rewrite URLs for the Session language negotiation method.

File

drupal/core/includes/language.inc, line 284
Language Negotiation API.

Code

function language_negotiation_method_enabled($method_id, $type = NULL) {
  $language_types = !empty($type) ? array(
    $type,
  ) : language_types_get_configurable();
  foreach ($language_types as $type) {
    $negotiation = variable_get("language_negotiation_{$type}", array());
    if (isset($negotiation[$method_id])) {
      return TRUE;
    }
  }
  return FALSE;
}