function imageapi_optimize_processor_integer_validate in Image Optimize (or ImageAPI Optimize) 7.2
Form element validation function, ensures that value is an integer.
Parameters
$element: The form element being validated.
$form_state: The form state collection of the form element being validated.
1 string reference to 'imageapi_optimize_processor_integer_validate'
- ImageAPIOptimizeProcessorReSmushIt::configForm in plugins/
imageapi_optimize/ ImageAPIOptimizeProcessorReSmushIt.inc
File
- ./
imageapi_optimize.module, line 929
Code
function imageapi_optimize_processor_integer_validate($element, &$form_state) {
$value = empty($element['#allow_negative']) ? $element['#value'] : preg_replace('/^-/', '', $element['#value']);
if ($element['#value'] != '' && (!is_numeric($value) || intval($value) <= 0)) {
if (empty($element['#allow_negative'])) {
form_error($element, t('!name must be an integer.', array(
'!name' => $element['#title'],
)));
}
else {
form_error($element, t('!name must be a positive integer.', array(
'!name' => $element['#title'],
)));
}
}
}