You are here

function _commerce_checkout_set_validated in Commerce Core 7

Set '#validated' on elements which have the specified parents.

1 call to _commerce_checkout_set_validated()
commerce_checkout_form_process_errors in modules/checkout/includes/commerce_checkout.pages.inc
After build callback for the checkout form.

File

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

Code

function _commerce_checkout_set_validated(&$element, $imploded_parents) {

  // Recurse to child elements if the current element is a container.
  foreach (element_children($element) as $key) {
    _commerce_checkout_set_validated($element[$key], $imploded_parents);
  }

  // This will also set #validated on all elements where #needs_validation would
  // be FALSE, but that doesn't hurt anything.
  if (!empty($element['#parents']) && strpos($imploded_parents, implode('][', $element['#parents'])) === 0) {
    $element['#validated'] = TRUE;
  }
}