You are here

function uc_coupon_ahah in Ubercart Discount Coupons 6

1 string reference to 'uc_coupon_ahah'
uc_coupon_menu in ./uc_coupon.module
Implementation of hook_menu().

File

./uc_coupon.admin.inc, line 798

Code

function uc_coupon_ahah($type) {
  $form_state = array(
    'storage' => NULL,
    'submitted' => FALSE,
  );
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);
  $args = $form['#parameters'];
  $form_id = array_shift($args);
  $form_state['post'] = $form['#post'] = $_POST;
  $form_state['action'] = $form['#action'];
  $form_state['ahah_submission'] = $type;
  $form['#programmed'] = $form['#redirect'] = FALSE;
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  unset($form[$type]['#prefix']);
  unset($form[$type]['#suffix']);
  $output = theme('status_messages') . drupal_render($form[$type]);
  drupal_json(array(
    'status' => TRUE,
    'data' => $output,
  ));
}