function options_array_flatten in Drupal 7
Flattens an array of allowed values.
Parameters
$array: A single or multidimensional array.
Return value
A flattened array.
2 calls to options_array_flatten()
- _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 - Defines selection, check box and radio button widgets for text and numeric fields.
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;
}