1 views_ui.admin.inc views_ui_pre_render_flatten_data($form)

Flattens the structure of an element containing the #flatten property.

If a form element has #flatten = TRUE, then all of it's children get moved to the same level as the element itself. So $form['to_be_flattened'][$key] becomes $form[$key], and $form['to_be_flattened'] gets unset.

File

core/modules/views_ui/views_ui.admin.inc, line 1832
Admin page callbacks for the Views UI module.

Code

function views_ui_pre_render_flatten_data($form) {
  foreach (element_children($form) as $key) {
    $element = $form[$key];
    if (!empty($element['#flatten'])) {
      foreach (element_children($element) as $child_key) {
        $form[$child_key] = $form[$key][$child_key];
      }
      // All done, remove the now-empty parent.
      unset($form[$key]);
    }
  }

  return $form;
}