function language_language_negotiation_info

Implements hook_language_negotiation_info().

2 calls to language_language_negotiation_info()
LanguageUILanguageNegotiationTest::testUILanguageNegotiation in drupal/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php
Tests for language switching by URL path.
LocaleUninstallTest::testUninstallProcess in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
Check if the values of the Locale variables are correct after uninstall.

File

drupal/core/modules/language/language.module, line 603
Add language handling functionality to Drupal.

Code

function language_language_negotiation_info() {
  language_negotiation_include();
  $file = drupal_get_path('module', 'language') . '/language.negotiation.inc';
  $negotiation_info = array();
  $negotiation_info[LANGUAGE_NEGOTIATION_URL] = array(
    'types' => array(
      LANGUAGE_TYPE_CONTENT,
      LANGUAGE_TYPE_INTERFACE,
      LANGUAGE_TYPE_URL,
    ),
    'callbacks' => array(
      'negotiation' => 'language_from_url',
      'language_switch' => 'language_switcher_url',
      'url_rewrite' => 'language_url_rewrite_url',
    ),
    'file' => $file,
    'weight' => -8,
    'name' => t('URL'),
    'description' => t('Language from the URL (Path prefix or domain).'),
    'config' => 'admin/config/regional/language/detection/url',
  );
  $negotiation_info[LANGUAGE_NEGOTIATION_SESSION] = array(
    'callbacks' => array(
      'negotiation' => 'language_from_session',
      'language_switch' => 'language_switcher_session',
      'url_rewrite' => 'language_url_rewrite_session',
    ),
    'file' => $file,
    'weight' => -6,
    'name' => t('Session'),
    'description' => t('Language from a request/session parameter.'),
    'config' => 'admin/config/regional/language/detection/session',
  );
  $negotiation_info[LANGUAGE_NEGOTIATION_USER] = array(
    'callbacks' => array(
      'negotiation' => 'language_from_user',
    ),
    'file' => $file,
    'weight' => -4,
    'name' => t('Account'),
    'description' => t('Account site language setting.'),
  );
  $negotiation_info[LANGUAGE_NEGOTIATION_BROWSER] = array(
    'callbacks' => array(
      'negotiation' => 'language_from_browser',
    ),
    'file' => $file,
    'weight' => -2,
    'cache' => 0,
    'name' => t('Browser'),
    'description' => t("Language from the browser's language settings."),
    'config' => 'admin/config/regional/language/detection/browser',
  );
  $negotiation_info[LANGUAGE_NEGOTIATION_INTERFACE] = array(
    'types' => array(
      LANGUAGE_TYPE_CONTENT,
    ),
    'callbacks' => array(
      'negotiation' => 'language_from_interface',
    ),
    'file' => $file,
    'weight' => 8,
    'name' => t('Interface'),
    'description' => t('Use the detected interface language.'),
  );
  $negotiation_info[LANGUAGE_NEGOTIATION_URL_FALLBACK] = array(
    'types' => array(
      LANGUAGE_TYPE_URL,
    ),
    'callbacks' => array(
      'negotiation' => 'language_url_fallback',
    ),
    'file' => $file,
    'weight' => 8,
    'name' => t('URL fallback'),
    'description' => t('Use an already detected language for URLs if none is found.'),
  );
  $negotiation_info[LANGUAGE_NEGOTIATION_USER_ADMIN] = array(
    'types' => array(
      LANGUAGE_TYPE_INTERFACE,
    ),
    'callbacks' => array(
      'negotiation' => 'language_from_user_admin',
    ),
    'file' => $file,
    'weight' => 10,
    'name' => t('Account administration pages'),
    'description' => t('Account administration pages language setting.'),
  );
  return $negotiation_info;
}