You are here

function tipsy_admin_validate in Tipsy 7

Implements hook_validate().

Validation is for admin form.

File

./tipsy.admin.inc, line 254

Code

function tipsy_admin_validate($form, &$form_values) {
  $drupal_forms = $form_values['values']['wrapper'];
  if ($form_values['values']['forms'] != 0) {
    if (!is_numeric($drupal_forms['options']['delayIn']) || $drupal_forms['options']['delayIn'] == '') {
      form_set_error('wrapper][options][delayIn', t('Invalid value'));
    }
    if (!is_numeric($drupal_forms['options']['delayOut']) || $drupal_forms['options']['delayOut'] == '') {
      form_set_error('wrapper][options][delayOut', t('Invalid value'));
    }
    if (!is_numeric($drupal_forms['options']['opacity']) || $drupal_forms['options']['opacity'] == '') {
      form_set_error('wrapper][options][opacity', t('Invalid value'));
    }
    if (!is_numeric($drupal_forms['options']['offset']) || $drupal_forms['options']['offset'] == '') {
      form_set_error('wrapper][options][offset', t('Invalid value'));
    }
  }
  foreach ($form_values['values']['rules'] as $delta => $rule) {
    if (trim($rule['selector']) != '') {
      if (!is_numeric($rule['options']['delayIn']) || $rule['options']['delayIn'] == '') {
        form_set_error('rules][' . $delta . '][options][delayIn', t('Invalid value'));
      }
      if (!is_numeric($rule['options']['delayOut']) || $rule['options']['delayOut'] == '') {
        form_set_error('rules][' . $delta . '][options][delayOut', t('Invalid value'));
      }
      if (!is_numeric($rule['options']['opacity']) || $rule['options']['opacity'] == '') {
        form_set_error('rules][' . $delta . '][options][opacity', t('Invalid value'));
      }
      if (!is_numeric($rule['options']['offset']) || $rule['options']['offset'] == '') {
        form_set_error('rules][' . $delta . '][options][offset', t('Invalid value'));
      }
    }
  }
}