You are here

function imagefield_focus_widget_validate in ImageField Focus 6

Same name and namespace in other branches
  1. 7 imagefield_focus.module \imagefield_focus_widget_validate()

Element #element_validate callback function.

1 string reference to 'imagefield_focus_widget_validate'
imagefield_focus_elements in ./imagefield_focus.module
Implementation of hook_elements().

File

./imagefield_focus.module, line 155
Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr

Code

function imagefield_focus_widget_validate($element, &$form_state) {
  foreach (array(
    'focus_rect',
    'crop_rect',
  ) as $key) {
    if (isset($element['#value']['data'][$key])) {
      $value = trim($element['#value']['data'][$key]);
      if (strlen($value) > 0 && !imagefield_focus_parse($value)) {
        form_error($element['data'][$key], t('The specified rectangle value is invalid.'));
      }
    }
  }
}