function uc_product_forms in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_product/uc_product.module \uc_product_forms()
- 7.3 uc_product/uc_product.module \uc_product_forms()
Implementation of hook_forms().
Register an "add to cart" form for each product to prevent id collisions.
File
- uc_product/
uc_product.module, line 400 - The product module for Ubercart.
Code
function uc_product_forms($saved_args) {
$forms = array();
if (substr($saved_args[0], 0, 27) == 'uc_product_add_to_cart_form' || substr($saved_args[0], 0, 26) == 'uc_catalog_buy_it_now_form') {
$product = $saved_args[1];
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;
}