You are here

function autocomplete_limit_element_validate_integer_not_negative in Autocomplete Limit Length 7

Validator for the limit.

1 string reference to 'autocomplete_limit_element_validate_integer_not_negative'
autocomplete_limit_form_system_performance_settings_alter in ./autocomplete_limit.module
Implements hook_form_FORM_ID_alter().

File

./autocomplete_limit.module, line 30
Functions for the autocomplete_limit module.

Code

function autocomplete_limit_element_validate_integer_not_negative($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value < 0)) {
    form_error($element, t('%name must be a positive integer or 0.', array(
      '%name' => $element['#title'],
    )));
  }
}