You are here

function uc_ajax_admin_form_submit in Ubercart 7.3

Submit handler for the uc_ajax_admin form.

File

uc_ajax_admin/uc_ajax_admin.module, line 75
Configures Ajax behaviours on the Ubercart checkout page.

Code

function uc_ajax_admin_form_submit($form, &$form_state) {
  $config = $form['#uc_ajax_config'];
  foreach ($form_state['values']['table'] as $index => $entry) {
    $key = $entry['key'];
    if ($index === '_new') {
      if (!empty($key) && !empty($entry['panes'])) {
        $config[$key] = $entry['panes'];
      }
    }
    elseif ($entry['remove'] || empty($entry['panes'])) {
      unset($config[$key]);
    }
    else {
      $config[$key] = $entry['panes'];
    }
  }
  variable_set('uc_ajax_' . $form['#uc_ajax_target'], $config);
  drupal_set_message(t('Your changes have been saved.'));
}