You are here

protected function WidgetBase::flattenOptions in Select (or other) 4.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/WidgetBase.php \Drupal\select_or_other\Plugin\Field\FieldWidget\WidgetBase::flattenOptions()

Flattens an array of allowed values.

Parameters

array $array: A single or multidimensional array.

Return value

array The flattened array.

1 call to WidgetBase::flattenOptions()
WidgetBase::getSelectedOptions in src/Plugin/Field/FieldWidget/WidgetBase.php
Determines selected options from the incoming field values.

File

src/Plugin/Field/FieldWidget/WidgetBase.php, line 207

Class

WidgetBase
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;
}