handleErrorsWithLimitedValidation example

// 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.'));
  }

  /** * Handles validation errors for forms with limited validation. * * If validation errors are limited then remove any non validated form values, * so that only values that passed validation are left for submit callbacks. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. * @param string $form_id * The unique string identifying the form. */
Home | Imprint | This part of the site doesn't use cookies.