domain_source_validate

Versions
domain
domain_source_validate($form, &$form_state)

Form validation step

Code

domain_source/domain_source.module, line 282

<?php
function domain_source_validate($form, &$form_state) {
  if ($form_state['values']['operation'] == 'domain') {
    ($form_state['values']['domain_source'] == 0) ? $key = -1 : $key = $form_state['values']['domain_source'];
    if ($form_state['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.
    }
    // Here we account for both the 'domains_raw' and 'domains' options.
    // If selected, these clauses will not be zero.
    else if (!$form_state['values']['domains'][$key] && (!empty($form_state['values']['domains_raw']) && !in_array($key, $form_state['values']['domains_raw']))) {
      form_set_error('domain_source', t('The source affiliate must be selected as a publishing option.'));
    }
  }
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List