4.7.x form.inc form_options_flatten($array, $reset = TRUE)
5.x form.inc form_options_flatten($array, $reset = TRUE)
6.x form.inc form_options_flatten($array, $reset = TRUE)
7.x form.inc form_options_flatten($array)

Related topics

1 call to form_options_flatten()
_form_validate in includes/form.inc
Performs validation on form elements. First ensures required fields are completed, #maxlength is not exceeded, and selected options were in the list of options given to the user. Then calls user-defined validators.

File

includes/form.inc, line 1470

Code

function form_options_flatten($array, $reset = TRUE) {
  static $return;
  if ($reset) {
    $return = array();
  }
  foreach ($array as $key => $value) {
    if (is_object($value)) {
      form_options_flatten($value->option, FALSE);
    }
    else {
      if (is_array($value)) {
        form_options_flatten($value, FALSE);
      }
      else {
        $return[$key] = 1;
      }
    }
  }
  return $return;
}