Verified Commit 97b0f9ad authored by Dave Long's avatar Dave Long
Browse files

docs: #3618255 FormValidator refers to self::METHODS() which don't exist

By: joachim
By: bt dev2
parent 5c44cbc6
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -61,10 +61,11 @@ public function validateForm($form_id, &$form, FormStateInterface &$form_state)
      return;
    }

    // If the session token was set by self::prepareForm(), ensure that it
    // If the session token was set by
    // \Drupal\Core\Form\FormBuilderInterface::prepareForm(), ensure that it
    // matches the current user's session. This is duplicate to code in
    // FormBuilder::doBuildForm() but left to protect any custom form handling
    // code.
    // \Drupal\Core\Form\FormBuilderInterface::doBuildForm() but left to protect
    // any custom form handling code.
    if (isset($form['#token'])) {
      if (!$this->csrfToken->validate($form_state->getValue('form_token'), $form['#token']) || $form_state->hasInvalidToken()) {
        $this->setInvalidTokenError($form_state);
@@ -135,10 +136,10 @@ protected function handleErrorsWithLimitedValidation(&$form, FormStateInterface
          NestedArray::setValue($values, $parents, $button_value);
        }

        // Additionally, self::doBuildForm() places the button value in
        // $form_state->getValue(BUTTON_NAME). If it's still there, after
        // validation handlers have run, copy it to $values, but do not override
        // what may already be in $values.
        // Additionally, \Drupal\Core\Form\FormBuilderInterface::doBuildForm()
        // places the button value in $form_state->getValue(BUTTON_NAME).
        // If it's still there, after validation handlers have run, copy it
        // to $values, but do not override what may already be in $values.
        $name = $triggering_element['#name'];
        if (!isset($values[$name]) && $form_state->getValue($name) === $button_value) {
          $values[$name] = $button_value;