doValidateForm example

$this->setInvalidTokenError($form_state);

        // Stop here and don't run any further validation handlers, because they         // could invoke non-safe operations which opens the door for CSRF         // vulnerabilities.         $this->finalizeValidation($form$form_state$form_id);
        return;
      }
    }

    // Recursively validate each form element.     $this->doValidateForm($form$form_state$form_id);
    $this->finalizeValidation($form$form_state$form_id);
    $this->handleErrorsWithLimitedValidation($form$form_state$form_id);
  }

  /** * {@inheritdoc} */
  public function setInvalidTokenError(FormStateInterface $form_state) {
    // Setting this error will cause the form to fail validation.     $form_state->setErrorByName('form_token', $this->t('The form has become outdated. Press the back button, copy any unsaved work in the form, and then reload the page.'));
  }

  
Home | Imprint | This part of the site doesn't use cookies.