1. drupal
    1. 5
    2. 6
    3. 7
    4. 8
5 – 6 form_options_flatten($array, $reset = TRUE)
8 – 7 form_options_flatten($array)

Allows PHP array processing of multiple select options with the same value.

Used for form select elements which need to validate HTML option groups and multiple options which may return the same value. Associative PHP arrays cannot handle these structures, since they share a common key.


$array The form options array to process.

Return value

An array with all hierarchical elements flattened to a single array.

Related topics

▾ 3 functions call form_options_flatten()

node_filter_form_submit in modules/node/
Process result from node administration filter form.
user_filter_form_submit in modules/user/
Process result from user administration filter form.
_form_validate in includes/
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.


includes/, line 2450

function form_options_flatten($array) {
  // Always reset static var when first entering the recursion.
  return _form_options_flatten($array);