You are here

function uc_ajax_replace_checkout_pane in Ubercart 7.3

Ajax callback to replace a whole checkout pane.

Parameters

$form: The checkout form.

$form_state: The current form state.

$wrapper: Special third parameter passed for uc_ajax callbacks containing the ajax wrapper for this callback. Here used to determine which pane to replace.

Return value

The form element representing the pane, suitable for ajax rendering. If the pane does not exist, or if the wrapper does not refer to a checkout pane, returns nothing.

2 string references to 'uc_ajax_replace_checkout_pane'
uc_ajax_process_form in uc_store/includes/uc_ajax_attach.inc
Form process callback to allow multiple Ajax callbacks on form elements.
uc_checkout_pane_quotes in shipping/uc_quote/uc_quote.module
Shipping quote checkout pane callback.

File

uc_store/includes/uc_ajax_attach.inc, line 196
Contains logic to aid in attaching multiple ajax behaviors to form elements on the checkout and order-edit forms.

Code

function uc_ajax_replace_checkout_pane($form, $form_state, $wrapper = NULL) {
  if (empty($wrapper) && !empty($form_state['triggering_element']['#ajax']['wrapper'])) {

    // If $wrapper is absent, then we were not invoked by uc_ajax_multiplex,
    // so try to use the wrapper of the triggering element's #ajax array.
    $wrapper = $form_state['triggering_element']['#ajax']['wrapper'];
  }
  if (!empty($wrapper)) {
    list($pane, $verify) = explode('-', $wrapper);
    if ($verify === 'pane' && !empty($form['panes'][$pane])) {
      return $form['panes'][$pane];
    }
  }
}