You are here

function _eminline_url_settings_form_validate in Embedded Media Field 6.2

Same name and namespace in other branches
  1. 5 contrib/eminline/eminline.module \_eminline_url_settings_form_validate()
  2. 6.3 contrib/eminline/eminline.module \_eminline_url_settings_form_validate()
  3. 6 contrib/eminline/eminline.module \_eminline_url_settings_form_validate()
1 string reference to '_eminline_url_settings_form_validate'
eminline_form_filter_admin_configure_alter in contrib/eminline/eminline.module
Implementation of hook_form_FORM_ID_alter().

File

contrib/eminline/eminline.module, line 241

Code

function _eminline_url_settings_form_validate($form, &$form_state) {
  $format = $form_state['values']['format'];
  if (!is_numeric($form_state['values']['eminline_' . $format]['video']['video_width']) || intval($form_state['values']['eminline_' . $format]['video']['video_width']) != $form_state['values']['eminline_' . $format]['video']['video_width'] || $form_state['values']['eminline_' . $format]['video']['video_width'] < 1) {
    form_set_error('eminline_' . $format . '][video][video_width', t('"Video width" must be a positive integer.'));
  }
  if (!is_numeric($form_state['values']['eminline_' . $format]['video']['video_height']) || intval($form_state['values']['eminline_' . $format]['video']['video_height']) != $form_state['values']['eminline_' . $format]['video']['video_height'] || $form_state['values']['eminline_' . $format]['video']['video_height'] < 1) {
    form_set_error('eminline_' . $format . '][video][video_height', t('"Video height" must be a positive integer.'));
  }
  if (!is_numeric($form_state['values']['eminline_' . $format]['preview']['preview_width']) || intval($form_state['values']['eminline_' . $format]['preview']['preview_width']) != $form_state['values']['eminline_' . $format]['preview']['preview_width'] || $form_state['values']['eminline_' . $format]['preview']['preview_width'] < 1) {
    form_set_error('eminline_' . $format . '][preview][preview_width', t('"Preview width" must be a positive integer.'));
  }
  if (!is_numeric($form_state['values']['eminline_' . $format]['preview']['preview_height']) || intval($form_state['values']['eminline_' . $format]['preview']['preview_height']) != $form_state['values']['eminline_' . $format]['preview']['preview_height'] || $form_state['values']['eminline_' . $format]['preview']['preview_height'] < 1) {
    form_set_error('eminline_' . $format . '][preview][preview_height', t('"Preview height" must be a positive integer.'));
  }
  if (!is_numeric($form_state['values']['eminline_' . $format]['tn']['thumbnail_height']) || intval($form_state['values']['eminline_' . $format]['tn']['thumbnail_height']) != $form_state['values']['eminline_' . $format]['tn']['thumbnail_height'] || $form_state['values']['eminline_' . $format]['tn']['thumbnail_height'] < 1) {
    form_set_error('eminline_' . $format . '][tn][thumbnail_height', t('"Thumbnail height" must be a positive integer.'));
  }
  if (!is_numeric($form_state['values']['eminline_' . $format]['tn']['thumbnail_width']) || intval($form_state['values']['eminline_' . $format]['tn']['thumbnail_width']) != $form_state['values']['eminline_' . $format]['tn']['thumbnail_width'] || $form_state['values']['eminline_' . $format]['tn']['thumbnail_width'] < 1) {
    form_set_error('eminline_' . $format . '][tn][thumbnail_width', t('"Thumbnail width" must be a positive integer.'));
  }
}