Problem/Motivation
We want to dissale the search field in select2 if only a limitted amount of options is present.
For example:
$elements['salutation'] = [
'#type' => 'select',
'#attributes' => ['data-options' => ['{"minimumResultsForSearch": 8}']],
'#options' => [
'Frau' => 'Frau',
'Herr' => 'Herr'
],
'#title' => t('Salutation'),
];
Steps to reproduce
Add data-options attribute to any webform select field.
Proposed resolution
fix web/modules/contrib/webform/js/webform.element.select2.js line 59
current:
options = $.extend(true, options, JSON.parse($input.attr('data-options')));
fxed:
options = $.extend(true, options, JSON.parse($select.attr('data-options')));
Comments
Comment #2
schoenef commentedThis patch fixes the issue.
Comment #3
liam morland