1 views.module views_language_list($field = 'name', $all = FALSE)

Returns an array of language names.

This is a one to one copy of language_list because we can't rely on enabled Locale module.

Parameters

$field: 'name' => names in current language, localized 'native' => native names

$all: Boolean to return all languages or only enabled ones

See also

language_list()

File

core/modules/views/views.module, line 743
Primarily Backdrop hooks and global API functions to manipulate views.

Code

function views_language_list($field = 'name', $all = FALSE) {
  if ($all) {
    $languages = language_list();
  }
  else {
    $languages = language_list(TRUE);
  }
  $list = array();
  foreach ($languages as $language) {
    $list[$language->langcode] = ($field == 'name') ? t($language->name) : $language->$field;
  }
  return $list;
}