You are here

function domain_source_validate in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_source/domain_source.module \domain_source_validate()
  2. 7.3 domain_source/domain_source.module \domain_source_validate()
  3. 7.2 domain_source/domain_source.module \domain_source_validate()

Form validation step

File

domain_source/domain_source.module, line 182
Creates a source domain for linking to content from other domains.

Code

function domain_source_validate($form_id, $form_values) {
  if ($form_values['operation'] == 'domain') {
    $form_values['domain_source'] == 0 ? $key = -1 : ($key = $form_values['domain_source']);
    if ($form_values['domain_site'] && $key == -1) {

      // This case is acceptable, so we let it pass.
      // I find this code easier to read than a compound IF statement.
    }
    else {
      if (!$form_values['domains'][$key] && (!empty($form_values['domains_raw']) && !in_array($key, $form_values['domains_raw']))) {
        form_set_error('domain_source', t('The source affiliate must be selected as a publishing option.'));
      }
    }
  }
}