You are here

function _better_revisions_validate in Better Revisions 7

Same name and namespace in other branches
  1. 8 better_revisions.module \_better_revisions_validate()
1 string reference to '_better_revisions_validate'
better_revisions_form_alter in ./better_revisions.module

File

./better_revisions.module, line 98
Main enhanced revisions module file.

Code

function _better_revisions_validate($form, &$form_state) {
  if (!$form_state['values']['revision'] || !isset($form_state['values']['revision'])) {
    return;
  }
  $req = variable_get('br_require', FALSE);
  $area = variable_get('br_add_txt', 0) == 2;
  if ($req) {
    if (empty($form_state['values']['log'])) {
      $msg = variable_get('br_list_title', BF_DEFAULT_TITLE) . ' is required';
      form_set_error('log', t($msg));
    }
  }
  if ($area) {
    if (empty($form_state['values']['log_extra'])) {
      $msg = variable_get('br_area_title', BF_DEFAULT_AREA_TITLE) . ' is required';
      form_set_error('log_extra', t($msg));
    }
  }
}