function patterns_options_flatten in Patterns 7
Same name and namespace in other branches
- 6.2 patterns.module \patterns_options_flatten()
- 6 patterns.module \patterns_options_flatten()
- 7.2 includes/unused.inc \patterns_options_flatten()
Helper function to flatter options, but keep the title/names in. @TODO Doc.
1 call to patterns_options_flatten()
- patterns_sync_form_values in includes/
unused.inc - Make some modifications to the form values based on the form In particular, make sure form elements with #options and #multiple set the keys of the array as the key of the value as how FAPI does it, but XML of course does not.
File
- includes/
unused.inc, line 717 - Functions that are unused at the moment.
Code
function patterns_options_flatten($array, $reset = TRUE) {
static $return;
if ($reset) {
$return = array();
}
foreach ($array as $key => $value) {
if (is_object($value)) {
patterns_options_flatten($value->option, FALSE);
}
elseif (is_array($value)) {
patterns_options_flatten($value, FALSE);
}
else {
$return[$key] = $value;
}
}
return $return;
}