function options_array_flatten

Flattens an array of allowed values.

Parameters

$array: A single or multidimensional array.

Return value

A flattened array.

3 calls to options_array_flatten()
list_field_validate in modules/field/modules/list/list.module
Implements hook_field_validate().
_options_get_options in modules/field/modules/options/options.module
Collects the options for a field.
_options_storage_to_form in modules/field/modules/options/options.module
Transforms stored field values into the format the widgets need.

File

modules/field/modules/options/options.module, line 376

Code

function options_array_flatten($array) {
  $result = array();
  if (is_array($array)) {
    foreach ($array as $key => $value) {
      if (is_array($value)) {
        $result += options_array_flatten($value);
      }
      else {
        $result[$key] = $value;
      }
    }
  }
  return $result;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.