You are here

function _imagefield_crop_widget_croparea_validate in Imagefield Crop 7.2

Same name and namespace in other branches
  1. 7 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 654
Functionality and Drupal hook implementations for the Imagefield Crop module.

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, intval($element['x']['#value']) . 'x' . intval($element['y']['#value']), $form_state);
}