You are here

function _webform_client_form_submit_flatten in Webform 7.4

Same name and namespace in other branches
  1. 5.2 webform.module \_webform_client_form_submit_flatten()
  2. 5 webform.module \_webform_client_form_submit_flatten()
  3. 6.3 webform.module \_webform_client_form_submit_flatten()
  4. 6.2 webform.module \_webform_client_form_submit_flatten()
  5. 7.3 webform.module \_webform_client_form_submit_flatten()

Flattens a submitted values back into a single flat array representation.

2 calls to _webform_client_form_submit_flatten()
webform_client_form_pages in ./webform.module
Handle the processing of pages and conditional logic.
webform_client_form_validate in ./webform.module
Form API #validate handler for the webform_client_form() form.

File

./webform.module, line 3537
This module provides a simple way to create forms and questionnaires.

Code

function _webform_client_form_submit_flatten($node, $fieldset, $parent = 0) {
  $values = array();
  if (is_array($fieldset)) {
    foreach ($fieldset as $form_key => $value) {
      if ($cid = webform_get_cid($node, $form_key, $parent)) {
        if (is_array($value) && webform_component_feature($node->webform['components'][$cid]['type'], 'group')) {
          $values += _webform_client_form_submit_flatten($node, $value, $cid);
        }
        else {
          $values[$cid] = $value;
        }
      }
      else {

        // This $form_key must belong to the parent. For example, a grid.
        $values[$parent][$form_key] = $value;
      }
    }
  }
  return $values;
}