You are here

protected function SelectOrOtherWidgetBase::flattenOptions in Select (or other) 8.3

Flattens an array of allowed values.

Parameters

array $array: A single or multidimensional array.

Return value

array The flattened array.

2 calls to SelectOrOtherWidgetBase::flattenOptions()
SelectOrOtherWidgetBase::getSelectedOptions in src/Plugin/Field/FieldWidget/SelectOrOtherWidgetBase.php
Determines selected options from the incoming field values.
Widget::getOptions in src/Plugin/Field/FieldWidget/Widget.php
Returns the array of options for the widget.

File

src/Plugin/Field/FieldWidget/SelectOrOtherWidgetBase.php, line 242
Contains \Drupal\select_or_other\Plugin\Field\FieldWidget\SelectOrOtherWidgetBase.

Class

SelectOrOtherWidgetBase
Base class for the 'select_or_other_*' widgets.

Namespace

Drupal\select_or_other\Plugin\Field\FieldWidget

Code

protected function flattenOptions(array $array) {
  $result = array();
  array_walk_recursive($array, function ($a, $b) use (&$result) {
    $result[$b] = $a;
  });
  return $result;
}