You are here

function imagecache_actions_validate_number_non_negative in ImageCache Actions 7

Same name and namespace in other branches
  1. 8 utility.inc \imagecache_actions_validate_number_non_negative()

Validates that the element is a non negative number.

This is a Form API #element_validate callback.

Parameters

array $element: param array $form_status

1 string reference to 'imagecache_actions_validate_number_non_negative'
canvasactions_file2canvas_form in canvasactions/canvasactions.inc
Image effect form callback for the overlay (watermark) effect.

File

./utility.inc, line 32
utility.inc: uitility form, conversion and rendering functions for image processing.

Code

function imagecache_actions_validate_number_non_negative(&$element) {
  $value = $element['#value'];
  if ($value != '') {
    if (!is_numeric($value) || (double) $value < 0.0) {
      form_error($element, t('%name must be a non negative number.', array(
        '%name' => $element['#title'],
      )));
    }
  }
}