You are here

function commerce_checkout_form_process_errors in Commerce Core 7

After build callback for the checkout form.

1 string reference to 'commerce_checkout_form_process_errors'
commerce_checkout_form in modules/checkout/includes/commerce_checkout.pages.inc
Builds the checkout form for the given order on the specified checkout page.

File

modules/checkout/includes/commerce_checkout.pages.inc, line 248
The page and form callbacks for use in the checkout form.

Code

function commerce_checkout_form_process_errors($form, $form_state) {

  // Do this only on form rebuild (when the form will not be validated anymore):
  if (!empty($form_state['storage']['errors']) && !empty($form_state['rebuild'])) {
    foreach (array_keys($form_state['storage']['errors']) as $element_name) {

      // Look for all elements which have $element_name as parents, and
      // restore their #validated property (so _form_set_class() will set
      // the error class even though the rebuilt form is not validated).
      // We can't simply use drupal_array_get_nested_value(), since the #parents
      // property may have been changed and not match the form structure.
      _commerce_checkout_set_validated($form, $element_name);
    }
  }
  return $form;
}