You are here

function ctools_language_list in Chaos Tool Suite (ctools) 7

Returns array of language names.

This is a one to one copy of locale_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

locale_language_list

2 calls to ctools_language_list()
ctools_context_language_settings_form in plugins/contexts/language.inc
Settings form.
ctools_language_list_all in includes/language.inc
Returns an array of language names similar to ctools_language_list() except that additional choices have been added for ease of use.

File

includes/language.inc, line 20

Code

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