protected function FlatteningOptionsTrait::flatteningOptions in Select2 Boxes 8
Flattening multi-bundled options to prevent possible collisions.
Parameters
array &$options: Options array.
2 calls to FlatteningOptionsTrait::flatteningOptions()
- MultiSelect2BoxesAutocompleteWidget::formElement in src/
Plugin/ Field/ FieldWidget/ MultiSelect2BoxesAutocompleteWidget.php - Returns the form for a single field widget.
- SingleSelect2BoxesAutocompleteWidget::formElement in src/
Plugin/ Field/ FieldWidget/ SingleSelect2BoxesAutocompleteWidget.php - Returns the form for a single field widget.
File
- src/
FlatteningOptionsTrait.php, line 18
Class
- FlatteningOptionsTrait
- Trait FlatteningOptionsTrait.
Namespace
Drupal\select2boxesCode
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;
}