You are here

function domain_prefix_configure_form_submit in Domain Access 6.2

Same name and namespace in other branches
  1. 5 domain_prefix/domain_prefix.module \domain_prefix_configure_form_submit()

FormsAPI for the domain_prefix_configure_form.

File

domain_prefix/domain_prefix.admin.inc, line 147
Admin page functions for selective table prefixing for use with Domain Access.

Code

function domain_prefix_configure_form_submit($form, &$form_state) {

  // Throw away what we don't need.
  $unset = array(
    'op',
    'submit',
    'restore',
    'form_token',
    'form_id',
    'form_build_id',
    'domain_prefix_options',
  );
  $data = $form_state['values'];
  foreach ($unset as $key) {
    unset($data[$key]);
  }
  if ($form_state['values']['op'] == $form_state['values']['restore']) {
    variable_del('domain_prefix');
    drupal_set_message(t('Default prefix settings reset.'));
  }
  else {

    // Process the source data.
    foreach ($data as $key => $value) {
      if (substr($key, 0, 8) == '_source_') {
        $info['sources'][$key] = $value;
      }
      else {
        $info['settings'][$key] = $value;
      }
    }
    variable_set('domain_prefix', $info);
    drupal_set_message(t('Default prefix settings changed.'));
  }
  variable_set('domain_prefix_options', $form_state['values']['domain_prefix_options']);
}