function language_list

cis7 language_list($field = 'language')
cle7 language_list($field = 'language')
elmsmedia7 language_list($field = 'language')
icor7 language_list($field = 'language')
meedjum_blog7 language_list($field = 'language')
mooc7 language_list($field = 'language')

Returns a list of installed languages, indexed by the specified key.


$field: (optional) The field to index the list with.

Return value

An associative array, keyed on the values of $field.

  • If $field is 'weight' or 'enabled', the array is nested, with the outer array's values each being associative arrays with language codes as keys and language objects as values.
  • For all other values of $field, the array is only one level deep, and the array's values are language objects.
55 calls to language_list()
adaptivetheme_form_search_form_alter in sites/all/themes/ulmus/adaptivetheme/at_core/inc/
hook_form_FORM_ID_alter() Modify the Advanced Search Form
advagg_advagg_context_alter in sites/all/modules/ulmus/advagg/
Implements hook_advagg_context_alter().
advagg_url_inbound_alter in sites/all/modules/ulmus/advagg/advagg.module
Inbound URL rewrite helper.
boost_parse_url in sites/all/modules/ulmus/boost/boost.module
parse_url that takes into account the base_path
ckeditor_link_get_languages in sites/all/modules/ulmus/ckeditor_link/ckeditor_link.module

... See full list

7 string references to 'language_list'
locale_add_language in includes/
API function to add a language.
locale_translate_export_screen in modules/locale/
User interface for the translation export screen.
locale_translate_import_form in modules/locale/
User interface for the translation import screen.
locale_translate_import_form_submit in modules/locale/
Process the locale import form submission.
locale_translate_overview_screen in modules/locale/
Overview screen for translations.

... See full list


includes/, line 2723
Functions that need to be loaded on every Drupal request.


function language_list($field = 'language') {
  $languages = &drupal_static(__FUNCTION__);
  // Init language list
  if (!isset($languages)) {
    if (drupal_multilingual() || module_exists('locale')) {
      $languages['language'] = db_query('SELECT * FROM {languages} ORDER BY weight ASC, name ASC')->fetchAllAssoc('language');
      // Users cannot uninstall the native English language. However, we allow
      // it to be hidden from the installed languages. Therefore, at least one
      // other language must be enabled then.
      if (!$languages['language']['en']->enabled && !variable_get('language_native_enabled', TRUE)) {
    else {
      // No locale module, so use the default language only.
      $default = language_default();
      $languages['language'][$default->language] = $default;

  // Return the array indexed by the right field
  if (!isset($languages[$field])) {
    $languages[$field] = array();
    foreach ($languages['language'] as $lang) {
      // Some values should be collected into an array
      if (in_array($field, array('enabled', 'weight'))) {
        $languages[$field][$lang->$field][$lang->language] = $lang;
      else {
        $languages[$field][$lang->$field] = $lang;
  return $languages[$field];