You are here

function editor_note_validate_size in Editor Notes 7

Validates form element that accepts positive integer value (px) or 'auto'.

1 string reference to 'editor_note_validate_size'
editor_note_field_settings_form in ./editor_note.module
Implements hook_field_settings_form().

File

./editor_note.module, line 1397
Main functionality for Editor Notes module.

Code

function editor_note_validate_size($element, &$form_state) {
  $value = $element['#value'];
  if (is_string($value) && $value !== 'auto' && ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value <= 0))) {
    $error = t('%name accepts either positive integer value (pixels) or "auto" (the browser calculates the height).', array(
      '%name' => $element['#title'],
    ));
    form_error($element, $error);
  }
}