function _image_field_resolution_validate

Element validate function for resolution fields.

1 string reference to '_image_field_resolution_validate'

File

drupal/core/modules/image/image.field.inc, line 192
Implement an image field, based on the file module's file field.

Code

function _image_field_resolution_validate($element, &$form_state) {
  if (!empty($element['x']['#value']) || !empty($element['y']['#value'])) {
    foreach (array(
      'x',
      'y',
    ) as $dimension) {
      if (!$element[$dimension]['#value']) {
        form_error($element[$dimension], t('Both a height and width value must be specified in the !name field.', array(
          '!name' => $element['#title'],
        )));
        return;
      }
    }
    form_set_value($element, $element['x']['#value'] . 'x' . $element['y']['#value'], $form_state);
  }
  else {
    form_set_value($element, '', $form_state);
  }
}