You are here

function bundle_clone_validate_selection in bundle clone 7

General validation for source and target widgets.

2 calls to bundle_clone_validate_selection()
bundle_clone_admin_display_validate in ./bundle_clone.display.inc
bundle_clone_admin_validate in ./bundle_clone.clone.inc

File

./bundle_clone.module, line 108

Code

function bundle_clone_validate_selection(&$form, &$form_state) {
  $source = $form_state['values']['config']['source'];
  $targets = $form_state['values']['config']['targets'];
  if ($source == 'none') {
    form_set_error('config][source', t('NO source bundle been selected'));
  }
  if (count($targets) == 1) {
    $target = key($targets);
    if ($target == 'none') {
      form_set_error('config][target', t('NO target bundle been selected'));
    }
    if ($source == $target) {
      form_set_error('config', t('Source being same as Target is an illogical choice'));
    }
  }
}