function language_process_language_select in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 $element 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 152 - Add language handling functionality to Drupal.
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'] = array();
foreach (\Drupal::languageManager()
->getLanguages($element['#languages']) as $langcode => $language) {
$element['#options'][$langcode] = $language
->isLocked() ? t('- @name -', array(
'@name' => $language
->getName(),
)) : $language
->getName();
}
}
return $element;
}