You are here

function uc_product_forms in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_forms()
  2. 7.3 uc_product/uc_product.module \uc_product_forms()

Implements hook_forms().

Registers an "add to cart" form for each product to prevent id collisions.

File

uc_product/uc_product.module, line 385
The product module for Ubercart.

Code

function uc_product_forms($form_id, $args) {
  $forms = array();
  if (isset($args[0]->nid) && isset($args[0]->type)) {
    $product = $args[0];
    if (in_array($product->type, array_keys(uc_product_node_info()))) {
      $forms['uc_product_add_to_cart_form_' . $product->nid] = array(
        'callback' => 'uc_product_add_to_cart_form',
      );
      $forms['uc_catalog_buy_it_now_form_' . $product->nid] = array(
        'callback' => 'uc_catalog_buy_it_now_form',
      );
    }
  }
  return $forms;
}