function image_effect_integer_validate
Element validate handler to ensure an integer pixel value.
The property #allow_negative = TRUE may be set to allow negative integers.
2 string references to 'image_effect_integer_validate'
- image_resize_form in modules/
image/ image.admin.inc - Form structure for the image resize form.
- image_rotate_form in modules/
image/ image.admin.inc - Form structure for the image rotate form.
File
-
modules/
image/ image.admin.inc, line 494
Code
function image_effect_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'],
)));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.