You are here

function _imagefield_crop_widget_croparea_validate in Imagefield Crop 7

Same name and namespace in other branches
  1. 7.2 imagefield_crop.module \_imagefield_crop_widget_croparea_validate()
1 string reference to '_imagefield_crop_widget_croparea_validate'
imagefield_crop_field_widget_settings_form in ./imagefield_crop.module
Implements hook_field_widget_settings_form().

File

./imagefield_crop.module, line 189
Provide a widget to crop uploaded image.

Code

function _imagefield_crop_widget_croparea_validate($element, &$form_state) {
  foreach (array(
    'x',
    'y',
  ) as $dimension) {
    $value = $element[$dimension]['#value'];
    if (!empty($value) && !is_numeric($value)) {
      form_error($element[$dimension], t('The @dimension value must be numeric.', array(
        '@dimesion' => $dimension,
      )));
      return;
    }
  }
  form_set_value($element, (int) $element['x']['#value'] . 'x' . (int) $element['y']['#value'], $form_state);
}