You are here

function _pardot_form_collapse in Pardot Integration 7

Same name and namespace in other branches
  1. 6 pardot.module \_pardot_form_collapse()

Collapses a submitted form into a flat array for Pardot.

1 call to _pardot_form_collapse()
pardot_webform_submit in ./pardot.module
Form submission handler for pardot_form_alter().

File

./pardot.module, line 430
Pardot integration module.

Code

function _pardot_form_collapse($form, $form_state) {
  $result = array();
  if (!empty($form_state['webform'])) {
    foreach ($form_state['webform']['component_tree']['children'] as $key => $value) {
      if (isset($form_state['values']['submitted'][$key])) {
        $form_tree[$value['form_key']] = $form_state['values']['submitted'][$key];
      }
    }
  }
  else {
    $form_tree = $form_state['values']['submitted'];
  }
  _pardot_form_collapse_form($form_tree, $form_state['values']['submitted'], $form['submitted'], $result);
  return $result;
}