function disable_language_language_select_after_build in Disable language 8
After build callback for language_select widgets.
1 string reference to 'disable_language_language_select_after_build'
File
- ./
disable_language.module, line 201 - Contains disable_language.module.
Code
function disable_language_language_select_after_build($element, $form_state) {
// Get disabled languages and remove them from options of language select.
$disabled_languages = \Drupal::service('disable_language.disable_language_manager')
->getDisabledLanguages();
foreach (array_keys($disabled_languages) as $langcode) {
if (isset($element['value']['#options'][$langcode])) {
unset($element['value']['#options'][$langcode]);
}
}
return $element;
}