function language_element_info_alter in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/language.module \language_element_info_alter()
- 9 core/modules/language/language.module \language_element_info_alter()
Implements hook_element_info_alter().
See also
\Drupal\Core\Render\Element\LanguageSelect
\Drupal\Core\Render\Element\Select
File
- core/
modules/ language/ language.module, line 121 - Add language handling functionality to Drupal.
Code
function language_element_info_alter(&$type) {
// Alter the language_select element so that it will be rendered like a select
// field.
if (isset($type['language_select'])) {
if (!isset($type['language_select']['#process'])) {
$type['language_select']['#process'] = [];
}
if (!isset($type['language_select']['#theme_wrappers'])) {
$type['language_select']['#theme_wrappers'] = [];
}
$type['language_select']['#process'] = array_merge($type['language_select']['#process'], [
'language_process_language_select',
[
'Drupal\\Core\\Render\\Element\\Select',
'processSelect',
],
[
'Drupal\\Core\\Render\\Element\\RenderElement',
'processAjaxForm',
],
]);
$type['language_select']['#theme'] = 'select';
$type['language_select']['#theme_wrappers'] = array_merge($type['language_select']['#theme_wrappers'], [
'form_element',
]);
$type['language_select']['#languages'] = LanguageInterface::STATE_CONFIGURABLE;
$type['language_select']['#multiple'] = FALSE;
}
}