function language_from_selected

Identifies language from configuration.

Parameters

$languages: An array of valid language objects.

Return value

A valid language code on success, FALSE otherwise.

Related topics

2 string references to 'language_from_selected'
language_negotiation_info in drupal/core/includes/language.inc
Returns all defined language negotiation methods.
locale_update_8013 in drupal/core/modules/locale/locale.install
Renames language_default language negotiation method to language_selected.

File

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

Code

function language_from_selected($languages) {
  $langcode = (string) config('language.negotiation')
    ->get('selected_langcode');

  // Replace the site's default langcode by its real value.
  if ($langcode == 'site_default') {
    $langcode = language_default()->langcode;
  }
  return isset($languages[$langcode]) ? $langcode : language_default()->langcode;
}