function dc_ajax_add_cart_form_alter in Commerce Ajax Add to Cart 7
Same name and namespace in other branches
- 7.2 dc_ajax_add_cart.module \dc_ajax_add_cart_form_alter()
Implements hook_form_alter().
File
- ./
dc_ajax_add_cart.module, line 179 - Ajax add to cart module.
Code
function dc_ajax_add_cart_form_alter(&$form, &$form_state, $form_id) {
if (strpos($form_id, 'commerce_cart_add_to_cart_form') !== FALSE) {
$form['submit']['#ajax'] = array(
'callback' => 'dc_ajax_add_cart_ajax_cart_form',
'method' => 'replace',
'effect' => 'slide',
);
$form['#attached']['js'][] = drupal_get_path('module', 'dc_ajax_add_cart') . '/js/dc_ajax_add_cart.js';
// Rebuild form.
$form['#submit'][] = 'dc_ajax_add_cart_rebuild_add_to_cart_form';
}
}