function _recovery_pass_validate_integer_positive in Recovery Password (Email New Password) 8
Validates for positive integer.
1 string reference to '_recovery_pass_validate_integer_positive'
- RecoveryPassSettingsForm::buildForm in src/
RecoveryPassSettingsForm.php - Form constructor.
File
- ./
recovery_pass.module, line 123 - Contains module code.
Code
function _recovery_pass_validate_integer_positive($element, FormState $form_state) {
$value = $element['#value'];
if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value <= 0)) {
$form_state
->setError($element, t('%name must be a positive integer.', array(
'%name' => $element['#title'],
)));
}
}