You are here

function _imagefield_crop_widget_custom_ratio_validate in Imagefield Crop 7.2

1 string reference to '_imagefield_crop_widget_custom_ratio_validate'
imagefield_crop_field_widget_settings_form in ./imagefield_crop.module
Implements hook_field_widget_settings_form().

File

./imagefield_crop.module, line 621
Functionality and Drupal hook implementations for the Imagefield Crop module.

Code

function _imagefield_crop_widget_custom_ratio_validate($element, &$form_state) {
  $settings = $form_state['values']['instance']['widget']['settings'];

  // _image_field_resolution_validate() does most of the validation
  // If enforce ratio is checked and resolution is not, then check for custom ratio.
  if ($settings['enforce_ratio'] && empty($settings['resolution']) && empty($element['x']['#value'])) {
    form_error($element, t('<em>Custom ratio</em> must be defined as WIDTH:HEIGHT if <em>Enforce crop box ratio</em> is set and output resolution is not defined'));
  }
}