The trimmed version (crucial for this issue) of \Drupal\Core\Render\Element\Weight::processWeight()
looks the following:
if ($element['#delta'] <= $max_elements) {
$element['#type'] = 'select';
$element += $element_info_manager->getInfo('select');
}
else {
$element['#type'] = 'number';
$element += $element_info_manager->getInfo('number');
}
Now imagine the case when $element['#delta']
exceeds system.site.weight_select_max
so the weight
element gets transformed to input[type=number]
instead of select
. The important part of that transformation is \Drupal\Core\Render\Element\Number::preRenderNumber()
, that is declared as one of the #pre_render
callbacks for number
.
However, the next hook may prevent input[type=number]
from being rendered at all and users will see undefined inputs without any attributes (i.e. <input />
):
function multiversion_element_info_alter(array &$types) {
foreach ($types as &$type) {
if (!isset($type['#pre_render'])) {
$type['#pre_render'] = [];
}
$type['#pre_render'][] = 'multiversion_element_pre_render';
}
}
*The code above has actually been taken from the multiversion module.
The described behavior is caused by the array concatenation ($element += $element_info_manager->getInfo('number');
) that adds only the values the keys of which are missing in the initial array.