protected function OptionsWidgetBase::flattenOptions

Flattens an array of allowed values.

Parameters

array $array: A single or multidimensional array.

Return value

array The flattened array.

2 calls to OptionsWidgetBase::flattenOptions()
OptionsWidgetBase::getOptions in drupal/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php
Returns the array of options for the widget.
OptionsWidgetBase::getSelectedOptions in drupal/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php
Determines selected options from the incoming field values.

File

drupal/core/modules/options/lib/Drupal/options/Plugin/field/widget/OptionsWidgetBase.php, line 190
Contains \Drupal\options\Plugin\field\widget\OptionsWidgetBase.

Class

OptionsWidgetBase
Base class for the 'options_*' widgets.

Namespace

Drupal\options\Plugin\field\widget

Code

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