You are here

function _epsacrop_aspect_ratio_validate in EPSA Crop - Image Cropping 7.2

Same name and namespace in other branches
  1. 8.2 epsacrop.module \_epsacrop_aspect_ratio_validate()

Validate a aspect ration information.

@access public

Parameters

array $element:

array &$form_state:

Return value

void

1 string reference to '_epsacrop_aspect_ratio_validate'
epsacrop_crop_image_form in ./epsacrop.module
Function that provide the effect form settings for dialog crop.

File

./epsacrop.module, line 702
The main file of module

Code

function _epsacrop_aspect_ratio_validate($element, &$form_state) {
  $value = $element['#value'];
  if (!empty($value)) {
    $parts = explode('/', $value);
    if (count($parts) == 2) {
      if (!is_numeric($parts[0]) || !is_numeric($parts[1])) {
        form_error($element, t('Both parts of !name must be an integer.', array(
          '!name' => check_plain($element['#title']),
        )));
      }
    }
    elseif (!is_numeric($value)) {
      form_error($element, t('!name must be an integer.', array(
        '!name' => check_plain($element['#title']),
      )));
    }
  }
}