You are here

function commerce_addressbook_checkout_form_callback in Commerce Addressbook 7.2

Ajax callback for replacing the appropriate commerce customer checkout pane.

1 string reference to 'commerce_addressbook_checkout_form_callback'
commerce_addressbook_form_alter in ./commerce_addressbook.module
Implements hook_form_alter().

File

./commerce_addressbook.module, line 426
Defines addressbook functionality for customer profiles, allowing them to be reused and managed on a per-user basis.

Code

function commerce_addressbook_checkout_form_callback($form, $form_state) {
  $pane_id = $form_state['triggering_element']['#parents'][0];

  // Add replace element as default AJAX command.
  $commands = array();
  $commands[] = ajax_command_replace(NULL, drupal_render($form[$pane_id]));

  // Allow other modules to add arbitrary AJAX commands on the refresh.
  drupal_alter('commerce_addressbook_callback', $commands, $form, $form_state);
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}