function views_language_list

Same name in other branches
  1. 6.x-3.x views.module \views_language_list()

Returns an 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

string $field: Either 'name' for localized names in current language or 'native' for native names.

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

See also

locale_language_list()

10 calls to views_language_list()
views_handler_argument_locale_language::locale_language in modules/locale/views_handler_argument_locale_language.inc
views_handler_argument_node_language::node_language in modules/node/views_handler_argument_node_language.inc
views_handler_field_locale_language::render in modules/locale/views_handler_field_locale_language.inc
Render the field.
views_handler_field_node_language::render in modules/locale/views_handler_field_node_language.inc
Render the field.
views_handler_filter_locale_language::get_value_options in modules/locale/views_handler_filter_locale_language.inc
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

... See full list

File

./views.module, line 1026

Code

function views_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;
}