You are here

function node_import_drupal_validate_form in Node import 6

The original version of drupal_validate_form() keeps a static array of validated forms. The modified version checks $form_state['must_validate'] to see if the form needs validation. If set and TRUE, validation is forced even if it was already done.

Related topics

1 call to node_import_drupal_validate_form()
node_import_drupal_process_form in ./node_import.inc
The original version of drupal_process_form() calls drupal_validate_form(). The modified version calls node_import_drupal_validate_form() instead.

File

./node_import.inc, line 2131
Public API of the Node import module.

Code

function node_import_drupal_validate_form($form_id, $form, &$form_state) {
  static $validated_forms = array();
  if (isset($validated_forms[$form_id]) && (!isset($form_state['must_validate']) || $form_state['must_validate'] !== TRUE)) {

    //Changed!
    return;
  }

  // If the session token was set by drupal_prepare_form(), ensure that it
  // matches the current user's session.
  if (isset($form['#token'])) {
    if (!drupal_valid_token($form_state['values']['form_token'], $form['#token'])) {

      // Setting this error will cause the form to fail validation.
      form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
    }
  }
  _form_validate($form, $form_state, $form_id);
  $validated_forms[$form_id] = TRUE;
}