You are here

function ajax_add_to_cart_form_alter in Ajax Add to Cart 8

Define changes for standard forms.

File

./ajax_add_to_cart.module, line 33
Contains ajax_add_to_cart.module.

Code

function ajax_add_to_cart_form_alter(&$form, &$form_state, $form_id) {

  // Check if the form builder implements the AddToCartFormInterface.
  if ($form_state
    ->getBuildInfo()['callback_object'] instanceof AddToCartFormInterface) {

    // Using getInstanace method to create Object.
    $object = AjaxCartHelper::getInstance();
    $object
      ->ajaxAddToCartAjaxForm($form_id, $form);
  }
}