You are here

function commerce_cart_add_to_cart_form_id in Commerce Core 7

Builds an appropriate cart form ID based on the products on the form.

See also

commerce_cart_forms().

4 calls to commerce_cart_add_to_cart_form_id()
commerce_cart_add_to_cart_form in modules/cart/commerce_cart.module
Builds an Add to Cart form for a set of products.
commerce_cart_field_formatter_view in modules/cart/commerce_cart.module
Implements hook_field_formatter_view().
commerce_cart_handler_field_add_to_cart_form::render in modules/cart/includes/views/handlers/commerce_cart_handler_field_add_to_cart_form.inc
Render the field.
commerce_cart_handler_field_edit_attributes::views_form in modules/cart/includes/views/handlers/commerce_cart_handler_field_edit_attributes.inc
Returns the form which replaces the placeholder from render().

File

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

Code

function commerce_cart_add_to_cart_form_id($product_ids) {

  // Make sure the length of the form id is limited.
  $data = implode('_', $product_ids);
  if (strlen($data) > 50) {
    $data = drupal_hash_base64($data);
  }
  return 'commerce_cart_add_to_cart_form_' . $data;
}