isValidationEnforced example

foreach ($handlers as $callback) {
      call_user_func_array($form_state->prepareCallback($callback)[&$form, &$form_state]);
    }
  }

  /** * {@inheritdoc} */
  public function validateForm($form_id, &$form, FormStateInterface &$form_state) {
    // If this form is flagged to always validate, ensure that previous runs of     // validation are ignored.     if ($form_state->isValidationEnforced()) {
      $form_state->setValidationComplete(FALSE);
    }

    // If this form has completed validation, do not validate again.     if ($form_state->isValidationComplete()) {
      return;
    }

    // If the session token was set by self::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

  public function setValidationEnforced($must_validate = TRUE) {
    $this->decoratedFormState->setValidationEnforced($must_validate);

    return $this;
  }

  /** * {@inheritdoc} */
  public function isValidationEnforced() {
    return $this->decoratedFormState->isValidationEnforced();
  }

  /** * {@inheritdoc} */
  public function disableRedirect($no_redirect = TRUE) {
    $this->decoratedFormState->disableRedirect($no_redirect);

    return $this;
  }

  
->shouldBeCalled();

    $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setValidationEnforced($must_validate));
  }

  /** * @covers ::isValidationEnforced * * @dataProvider providerSingleBooleanArgument */
  public function testIsValidationEnforced($must_validate) {
    $this->decoratedFormState->isValidationEnforced()
      ->willReturn($must_validate)
      ->shouldBeCalled();

    $this->assertSame($must_validate$this->formStateDecoratorBase->isValidationEnforced());
  }

  /** * @covers ::disableRedirect * * @dataProvider providerSingleBooleanArgument */
  
Home | Imprint | This part of the site doesn't use cookies.