You are here

function _chosen_flattern_options in Chosen 7.3

Implementation of _chosen_flattern_options()

This function collects all field options out of a form array and generates a one dimensional array.

Parameters

$options: The form array provided by a plugin.

Return value

The flat array of all fields.

1 call to _chosen_flattern_options()
chosen_library in ./chosen.module
Implements hook_library().

File

./chosen.module, line 347
General functions and hook implementations.

Code

function _chosen_flattern_options($options) {
  $flat_array = array();
  foreach ($options as $key => $value) {
    if (isset($value['#default_value'])) {
      $flat_array[$key] = $value;
    }
    elseif (is_array($value)) {
      $flat_array = array_merge($flat_array, _chosen_flattern_options($value));
    }
  }
  return $flat_array;
}