You are here

function advancedqueue_element_validate_integer_positive in Advanced Queue 7

Form element validation handler for integer elements that must be positive.

Similar to element_validate_integer_positive(), but allows for 0 values.

See also

advancedqueue_settings_form()

1 string reference to 'advancedqueue_element_validate_integer_positive'
advancedqueue_settings_form in ./advancedqueue.admin.inc
Form callback: builds the Advanced Queue settings form.

File

./advancedqueue.module, line 287
Helper module for advanced queuing.

Code

function advancedqueue_element_validate_integer_positive($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.', array(
      '%name' => $element['#title'],
    )));
  }
}