Full ELMS Learning Network documentation
function language_list
cis7 bootstrap.inc | language_list($field = 'language') |
cle7 bootstrap.inc | language_list($field = 'language') |
elmsmedia7 bootstrap.inc | language_list($field = 'language') |
icor7 bootstrap.inc | language_list($field = 'language') |
meedjum_blog7 bootstrap.inc | language_list($field = 'language') |
mooc7 bootstrap.inc | language_list($field = 'language') |
Returns a list of installed languages, indexed by the specified key.
Parameters
$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/ alter.inc - hook_form_FORM_ID_alter() Modify the Advanced Search Form
- advagg_advagg_context_alter in sites/
all/ modules/ ulmus/ advagg/ advagg.advagg.inc - 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
7 string references to 'language_list'
- locale_add_language in includes/
locale.inc - API function to add a language.
- locale_translate_export_screen in modules/
locale/ locale.admin.inc - User interface for the translation export screen.
- locale_translate_import_form in modules/
locale/ locale.admin.inc - User interface for the translation import screen.
- locale_translate_import_form_submit in modules/
locale/ locale.admin.inc - Process the locale import form submission.
- locale_translate_overview_screen in modules/
locale/ locale.admin.inc - Overview screen for translations.
File
- includes/
bootstrap.inc, line 2723 - Functions that need to be loaded on every Drupal request.
Code
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)) {
unset($languages['language']['en']);
}
}
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];
}