function language_negotiation_info

Returns all defined language negotiation methods.

Return value

An array of language negotiation methods.

Related topics

5 calls to language_negotiation_info()
language_negotiation_configure_form in drupal/core/modules/language/language.admin.inc
Builds the configuration form for language negotiation.
language_negotiation_method_invoke in drupal/core/includes/language.inc
Invokes a language negotiation method and caches the results.
language_negotiation_purge in drupal/core/includes/language.inc
Removes any language negotiation methods that are no longer defined.
language_negotiation_set in drupal/core/includes/language.inc
Saves a list of language negotiation methods for a language type.
language_types_set in drupal/core/includes/language.inc
Updates the language type configuration.
3 string references to 'language_negotiation_info'
LanguageNegotiationInfoTest::languageNegotiationUpdate in drupal/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php
Update language types/negotiation information.
language_negotiation_purge in drupal/core/includes/language.inc
Removes any language negotiation methods that are no longer defined.
language_types_set in drupal/core/includes/language.inc
Updates the language type configuration.

File

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

Code

function language_negotiation_info() {
  $negotiation_info =& drupal_static(__FUNCTION__);
  if (!isset($negotiation_info)) {

    // Collect all the module-defined language negotiation methods.
    $negotiation_info = module_invoke_all('language_negotiation_info');
    $languages = language_list();
    $selected_language = $languages[language_from_selected($languages)];
    $description = 'Language based on a selected language. ';
    $description .= $selected_language->langcode == language_default()->langcode ? "(Site's default language (@language_name))" : '(@language_name)';

    // Add the default language negotiation method.
    $negotiation_info[LANGUAGE_NEGOTIATION_SELECTED] = array(
      'callbacks' => array(
        'negotiation' => 'language_from_selected',
      ),
      'weight' => 12,
      'name' => t('Selected language'),
      'description' => t($description, array(
        '@language_name' => $selected_language->name,
      )),
      'config' => 'admin/config/regional/language/detection/selected',
    );

    // Let other modules alter the list of language negotiation methods.
    drupal_alter('language_negotiation_info', $negotiation_info);
  }
  return $negotiation_info;
}