Prepares a list of language names.
This is a wrapper around language_list to return a plain key value array.
string $field: The field of the language object which should be used as the value of the array.
int $flags: (optional) Specifies the state of the languages that have to be returned. It can be: LANGUAGE_CONFIGURABLE, LANGUAGE_LOCKED, LANGUAGE_ALL.
array An array of language names (or $field) keyed by the langcode.
locale_language_list()
function views_language_list($field = 'name', $flags = LANGUAGE_ALL) {
$languages = language_list($flags);
$list = array();
foreach ($languages as $language) {
$list[$language->langcode] = $field == 'name' ? t($language->name) : $language->{$field};
}
return $list;
}