You are here

function image_effects_text_form_validate in ImageCache Actions 7

Same name and namespace in other branches
  1. 8 image_effects_text/image_effects_text.inc \image_effects_text_form_validate()

Element validation callback for the effect form.

See also

http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....

1 string reference to 'image_effects_text_form_validate'
image_effects_text_form_inc in image_effects_text/image_effects_text.inc
Image effect form callback for the text effect.

File

image_effects_text/image_effects_text.inc, line 251

Code

function image_effects_text_form_validate(array $element) {
  if (!is_numeric($element['size']['#value']) || $element['size']['#value'] <= 0) {
    form_error($element['size'], t('%field must be a positive number.', array(
      '%field' => t('Font size'),
    )));
  }
  if (!is_numeric($element['alpha']['#value']) || $element['alpha']['#value'] < 0 || $element['alpha']['#value'] > 100) {
    form_error($element['alpha'], t('%field must be a number between 1 and 100.', array(
      '%field' => t('Opacity'),
    )));
  }
  if (!is_numeric($element['angle']['#value'])) {
    form_error($element['angle'], t('%field must be a number.', array(
      '%field' => t('Angle'),
    )));
  }
}