You are here

function _video_validate_number in Video 6.4

Same name and namespace in other branches
  1. 6.5 video.admin.inc \_video_validate_number()
1 string reference to '_video_validate_number'
video_players_admin_settings in ./video.admin.inc
Video player admin settings

File

./video.admin.inc, line 157

Code

function _video_validate_number($element, $form_state) {
  $key = end($element['#parents']);
  $val = $form_state['values'][$key];
  if (!empty($val) && (!preg_match('#^\\d+$#', $val) || intval($val) < 0)) {
    form_error($element, t('You must enter an integer value for field %field.', array(
      '%field' => $element['#title'],
    )));
  }
}