You are here

function imagecache_actions_validate_number_positive in ImageCache Actions 7

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

Validates that the element is a positive number.

This is a Form API #element_validate callback.

Parameters

array $element: param array $form_status

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

File

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

Code

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