You are here

function animate_any_settings_validate in Animate Any 7

Validate the animation form.

File

./animate_any.module, line 205
Add CSS3 cross-browser animation to any Drupal site.

Code

function animate_any_settings_validate($form, &$form_state) {
  if ($form_state['values']['op'] == 'Save Settings') {
    $parent = $form_state['values']['parent_class'];
    if (empty($parent)) {
      $form_state['rebuild'] = TRUE;
      form_set_error("parent_class", t("Please select parent class"));
    }

    // check all the section validation
    if (!empty($form_state['values']['animate_fieldset'])) {
      foreach ($form_state['values']['animate_fieldset'] as $key => $value) {
        if (empty($value['section_identity'])) {
          $form_state['rebuild'] = TRUE;
          form_set_error("animate_fieldset][{$key}][section_identity", t("Please select section identity for row @key", array(
            '@key' => $key,
          )));
        }
        if ($value['section_animation'] == 'none') {
          $form_state['rebuild'] = TRUE;
          form_set_error("animate_fieldset][{$key}][section_animation", t("Please select section animation for row @key", array(
            '@key' => $key,
          )));
        }
      }
    }
    else {
      $form_state['rebuild'] = TRUE;
      form_set_error("", t("Please add some section for animation"));
    }
  }
}