You are here

function domain_form_submit in Domain Access 7.2

Same name and namespace in other branches
  1. 6.2 domain.admin.inc \domain_form_submit()
  2. 7.3 domain.admin.inc \domain_form_submit()

Implement domain_form submit hook.

File

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

Code

function domain_form_submit($form, &$form_state) {
  $values = domain_values_from_form_state($form_state);

  // Set the proper message
  if (!empty($values['domain_id'])) {
    $message = t('Domain record updated.');
  }
  else {
    $message = t('Domain record created.');
  }

  // Run the save routine.
  $domain = domain_save($values, $form_state);

  // If return is not a $domain array, something went wrong.
  if ($domain == -1) {
    $message = t('Domain record failed.');
  }

  // Hide the message for the Domain User module.
  if (empty($form_state['values']['domain_arguments']['user_submitted'])) {
    drupal_set_message($message);
  }
  return $domain;
}