You are here

function domain_form_validate in Domain Access 7.3

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

Implement domain_form validate hook.

1 string reference to 'domain_form_validate'
domain_form in ./domain.admin.inc
FormsAPI for editing a domain record

File

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

Code

function domain_form_validate($form, &$form_state) {
  $subdomain = $form_state['values']['subdomain'];
  $error_list = array();
  $domain_changed = (bool) strcmp($form_state['values']['subdomain'], $form['subdomain']['#default_value']);
  if ($domain_changed && !domain_unique_domain($subdomain)) {
    $error_list[] = t('The domain value must be unique.');
  }
  $error = domain_valid_domain($subdomain);
  if (!empty($error)) {
    $error_list[] = $error;
  }
  foreach ($error_list as $error) {
    form_set_error('subdomain', $error);
  }
  if (!empty($form_state['values']['is_default']) && empty($form_state['values']['ignore'])) {
    $error = domain_check_response($form_state['values']);
    if ($error) {
      $error = t('This domain may not be set as your primary domain.') . '<br />' . $error;
      form_set_error('is_default', $error);
    }
  }
}