function language_process_language_select
Same name in other branches
- 9 core/modules/language/language.module \language_process_language_select()
- 8.9.x core/modules/language/language.module \language_process_language_select()
- 11.x core/modules/language/language.module \language_process_language_select()
Processes a language select list form element.
Parameters
array $element: The form element to process.
Return value
array The processed form element.
1 string reference to 'language_process_language_select'
- language_element_info_alter in core/
modules/ language/ language.module - Implements hook_element_info_alter().
File
-
core/
modules/ language/ language.module, line 155
Code
function language_process_language_select($element) {
// Don't set the options if another module (translation for example) already
// set the options.
if (!isset($element['#options'])) {
$element['#options'] = [];
foreach (\Drupal::languageManager()->getLanguages($element['#languages']) as $langcode => $language) {
$element['#options'][$langcode] = $language->isLocked() ? t('- @name -', [
'@name' => $language->getName(),
]) : $language->getName();
}
}
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.