You are here

function domain_overview_form_submit in Domain Access 7.3

Submit handler for the domain overview form.

File

./domain.admin.inc, line 139
Administration functions for the domain module.

Code

function domain_overview_form_submit($form, &$form_state) {
  $values = $form_state['values']['domain'];
  foreach ($values as $domain_id => $value) {
    $default = 0;
    $valid = $value['valid'];

    // Process the default domain.
    if ($form_state['values']['default_domain'] == $domain_id) {
      $default = 1;
      $valid = 1;

      // Indicate a message if the value changed.
      if ($domain_id != $form_state['complete form']['default_domain']['#default_value']) {
        drupal_set_message(t('The primary domain has been set to %domain.', array(
          '%domain' => domain_get_path($value['values']),
        )));
      }
    }
    db_update('domain')
      ->fields(array(
      'weight' => $value['weight'],
      'is_default' => $default,
      'valid' => $valid,
    ))
      ->condition('domain_id', $domain_id)
      ->execute();
  }
  drupal_set_message(t('Domain settings updated'));
}