trait FlatteningOptionsTrait in Select2 Boxes 8
Trait FlatteningOptionsTrait.
@package Drupal\select2boxes
Hierarchy
- trait \Drupal\select2boxes\FlatteningOptionsTrait
2 files declare their use of FlatteningOptionsTrait
- MultiSelect2BoxesAutocompleteWidget.php in src/
Plugin/ Field/ FieldWidget/ MultiSelect2BoxesAutocompleteWidget.php - SingleSelect2BoxesAutocompleteWidget.php in src/
Plugin/ Field/ FieldWidget/ SingleSelect2BoxesAutocompleteWidget.php
File
- src/
FlatteningOptionsTrait.php, line 10
Namespace
Drupal\select2boxesView source
trait FlatteningOptionsTrait {
/**
* Flattening multi-bundled options to prevent possible collisions.
*
* @param array &$options
* Options array.
*/
protected function flatteningOptions(array &$options) {
// Fix for multi-bundled options.
$flat_options = [];
foreach ($options as $key => $option) {
if (is_array($option)) {
$flat_options += $option;
unset($options[$key]);
}
}
$options += $flat_options;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FlatteningOptionsTrait:: |
protected | function | Flattening multi-bundled options to prevent possible collisions. |