function commerce_checkout_forms in Commerce Core 7
Implements hook_forms().
Each page of the checkout form is actually a unique form as opposed to a single multistep form. To accommodate this, we map any form ID beginning with commerce_checkout_form_ to the same form builder assuming the remainder of the form ID matches a valid checkout page ID.
File
- modules/
checkout/ commerce_checkout.module, line 225 - Enable checkout as a multi-step form with customizable pages and a simple checkout pane API.
Code
function commerce_checkout_forms($form_id, $args) {
$forms = array();
// All checkout page forms should be built using the same function.
if (strpos($form_id, 'commerce_checkout_form_') === 0) {
// Ensure the checkout page is valid.
if (commerce_checkout_page_load(substr($form_id, 23))) {
$forms[$form_id] = array(
'callback' => 'commerce_checkout_form',
);
}
}
$forms['commerce_checkout_add_complete_rule_form'] = array(
'callback' => 'rules_admin_add_reaction_rule',
);
return $forms;
}