image_effect_integer_validate
function image_effect_integer_validate
image_effect_integer_validate($element, &$form_state)
Element validate handler to ensure an integer pixel value.
The property #allow_negative = TRUE may be set to allow negative integers.
File
- modules/image/image.admin.inc, line 481
- Administration pages for image settings.
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']))); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!image!image.admin.inc/function/image_effect_integer_validate/7.x