You are here

function commerce_cart_forms in Commerce Core 7

Implements hook_forms().

To provide distinct form IDs for add to cart forms, the product IDs referenced by the form are appended to the base ID, commerce_cart_add_to_cart_form. When such a form is built or submitted, this function will return the proper callback function to use for the given form.

File

modules/cart/commerce_cart.module, line 1712
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_forms($form_id, $args) {
  $forms = array();

  // Construct a valid cart form ID from the arguments.
  if (strpos($form_id, 'commerce_cart_add_to_cart_form_') === 0) {
    $forms[$form_id] = array(
      'callback' => 'commerce_cart_add_to_cart_form',
    );
  }
  return $forms;
}