trait MinSearchLengthTrait in Select2 Boxes 8
Trait MinSearchLengthTrait.
@package Drupal\select2boxes
Hierarchy
- trait \Drupal\select2boxes\MinSearchLengthTrait
2 files declare their use of MinSearchLengthTrait
- Select2BoxesAutocompleteListWidget.php in src/
Plugin/ Field/ FieldWidget/ Select2BoxesAutocompleteListWidget.php - SingleSelect2BoxesAutocompleteWidget.php in src/
Plugin/ Field/ FieldWidget/ SingleSelect2BoxesAutocompleteWidget.php
File
- src/
MinSearchLengthTrait.php, line 10
Namespace
Drupal\select2boxesView source
trait MinSearchLengthTrait {
/**
* Limit search input visibility by results length.
*
* @param array $attributes
* Element attributes array.
*/
protected function limitSearchByMinLength(array &$attributes) {
$config = \Drupal::config('select2boxes.settings');
if ($config
->get('limited_search') == '1') {
$length = $config
->get('minimum_search_length') ?: 0;
$attributes['data-minimum-search-length'] = $length;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MinSearchLengthTrait:: |
protected | function | Limit search input visibility by results length. |