You are here

function multiform_sharedfields_process in Multiple forms 7.2

Process sharedfields. Hide dependent sharedfields at form rendering and set their values in _POST after form submission.

2 calls to multiform_sharedfields_process()
multiform_form_after_build in ./multiform.module
Multiform subform #after_build.
multiform_get_form in ./multiform.module
Returns a form containing a number of other forms.

File

./multiform.module, line 235

Code

function multiform_sharedfields_process($settings, &$form = NULL, &$form_state = NULL) {
  module_load_include('inc', 'multiform', 'multiform.sharedfields');
  if ($settings) {
    $sharedfields_info = multiform_sharedfields_info($settings);
    if (!empty($_POST)) {
      multiform_sharedfields_set_post_values($settings, $sharedfields_info);
    }
  }
  elseif (!$settings && !empty($form) && isset($form_state['#multiform_settings'])) {
    $settings = $form_state['#multiform_settings'];
    $sharedfields_info = multiform_sharedfields_info($settings);

    // @todo: Do smth with hidden fields validation
    multiform_sharedfields_hide_elements($settings, $sharedfields_info, $form, $form_state);
  }
}