You are here

function uniqueness_form_validate_results_max in Uniqueness 6

Same name and namespace in other branches
  1. 7 uniqueness.admin.inc \uniqueness_form_validate_results_max()

Implementation of hook_form_validate().

1 string reference to 'uniqueness_form_validate_results_max'
uniqueness_settings in ./uniqueness.admin.inc
Form builder for uniqueness settings page; system_settings_form().

File

./uniqueness.admin.inc, line 133
Settings page for the uniqueness module.

Code

function uniqueness_form_validate_results_max($element, &$form_state) {

  // Validate that the number of results to show is numeric and within range
  $upper_limit = $form_state['values']['uniqueness_search_mode'] == UNIQUENESS_SEARCH_MODE_DRUPAL ? 10 : 100;
  $value = $element['#value'];
  if (!is_numeric($value) || $value <= 0 || $value > $upper_limit) {
    form_error($element, t('The number of results must be between 1 and @upper.', array(
      '@upper' => $upper_limit,
    )));
  }
}