You are here

function resource_conflict_form_validate in Resource Conflict 7.2

Same name and namespace in other branches
  1. 5.2 resource_conflict.module \resource_conflict_form_validate()
  2. 6.2 resource_conflict.module \resource_conflict_form_validate()
  3. 7.3 resource_conflict.module \resource_conflict_form_validate()

Validate the node_type_form

1 string reference to 'resource_conflict_form_validate'
resource_conflict_form_alter in ./resource_conflict.module
Implementation of hook_form_alter

File

./resource_conflict.module, line 239

Code

function resource_conflict_form_validate($form, &$form_state) {
  if ($form_state['values']['form_id'] == 'node_type_form') {
    if ($form_state['values']['rc_type']) {
      $resource_selected = FALSE;
      foreach ($form_state['values']['rc_reference_fields'] as $field) {
        if ($field) {
          $resource_selected = TRUE;
          break;
        }
      }
      if (!$resource_selected) {
        form_set_error('rc_reference_fields', t("At least one resource field must be set if conflict handling is enabled."));
      }
    }
  }
}