You are here

function imagecrop_validate_aspect in Image javascript crop 7

Same name and namespace in other branches
  1. 6 imagecrop_actions.inc \imagecrop_validate_aspect()

Validation function to validate an entered aspect value.

1 string reference to 'imagecrop_validate_aspect'
imagecrop_effect_form in includes/imagecrop.effects.inc
Settings form for configuring a javascript imagecrop effect.

File

includes/imagecrop.effects.inc, line 212
Registry for the image style effects from imagecrop.

Code

function imagecrop_validate_aspect($element, &$form_state) {
  if ($element['#value'] == '') {
    return;
  }

  // numbers are allowed.
  if (is_numeric($element['#value'])) {
    return;
  }

  // if the value is a string, check on allowed strings
  if ($element['#value'] != 'KEEP' && $element['#value'] != 'CROP') {
    form_error($element, t('@name must be a correct aspect value', array(
      '@name' => $element['#title'],
    )));
  }
}