isProcessingInput example


  public function setProcessInput($process_input = TRUE) {
    $this->decoratedFormState->setProcessInput($process_input);

    return $this;
  }

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

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

    return $this;
  }

  

  public static function assessActiveTextEditorAfterBuild(array $element, FormStateInterface $form_state): array {
    // The case of the form being built initially, and the text editor plugin in     // use is already CKEditor 5.     if (!$form_state->isProcessingInput()) {
      $editor = $form_state->get('editor');
      $already_using_ckeditor5 = $editor && $editor->getEditor() === 'ckeditor5';
    }
    else {
      // Whenever there is user input, this cannot be the initial build of the       // form and hence we need to inspect user input.       $already_using_ckeditor5 = FALSE;
      NestedArray::getValue($form_state->getUserInput()['editor', 'settings', 'is_already_using_ckeditor5']$already_using_ckeditor5);
    }

    $form_state->set('ckeditor5_is_active', $already_using_ckeditor5);
    


  /** * {@inheritdoc} */
  public function getCacheableArray() {
    return [
      'build_info' => $this->getBuildInfo(),
      'response' => $this->getResponse(),
      'programmed' => $this->isProgrammed(),
      'programmed_bypass_access_check' => $this->isBypassingProgrammedAccessChecks(),
      'process_input' => $this->isProcessingInput(),
      'has_file_element' => $this->hasFileElement(),
      'storage' => $this->getStorage(),
      // Use the properties directly, since self::isCached() combines them and       // cannot be relied upon.       'cache' => $this->cache,
      'no_cache' => $this->no_cache,
    ];
  }

  /** * {@inheritdoc} */
->shouldBeCalled();

    $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setProcessInput($process_input));
  }

  /** * @covers ::isProcessingInput * * @dataProvider providerSingleBooleanArgument */
  public function testIsProcessingInput($process_input) {
    $this->decoratedFormState->isProcessingInput()
      ->willReturn($process_input)
      ->shouldBeCalled();

    $this->assertSame($process_input$this->formStateDecoratorBase->isProcessingInput());
  }

  /** * @covers ::setProgrammed * * @dataProvider providerSingleBooleanArgument */
  
/** * Form element #after_build callback: Updates the entity with submitted data. * * Updates the internal $this->entity object with submitted values when the * form is being rebuilt (e.g. submitted via AJAX), so that subsequent * processing (e.g. AJAX callbacks) can rely on it. */
  public function afterBuild(array $element, FormStateInterface $form_state) {
    // Rebuild the entity if #after_build is being called as part of a form     // rebuild, i.e. if we are processing input.     if ($form_state->isProcessingInput()) {
      $this->entity = $this->buildEntity($element$form_state);
    }

    return $element;
  }

  /** * Returns the action form element for the current entity form. */
  protected function actionsElement(array $form, FormStateInterface $form_state) {
    $element = $this->actions($form$form_state);

    


    // After processing the form, if this is an AJAX form request, interrupt     // form rendering and return by throwing an exception that contains the     // processed form and form state. This exception will be caught by     // \Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber::onException() and     // then passed through     // \Drupal\Core\Form\FormAjaxResponseBuilderInterface::buildResponse() to     // build a proper AJAX response.     // Only do this when the form ID matches, since there is no guarantee from     // $ajax_form_request that it's an AJAX request for this particular form.     if ($ajax_form_request && $form_state->isProcessingInput() && $request->request->get('form_id') == $form_id) {
      throw new FormAjaxException($form$form_state);
    }

    // If the form returns a response, skip subsequent page construction by     // throwing an exception.     // @see Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber     //     // @todo Exceptions should not be used for code flow control. However, the     // Form API does not integrate with the HTTP Kernel based architecture of     // Drupal 8. In order to resolve this issue properly it is necessary to     // completely separate form submission from rendering.
Home | Imprint | This part of the site doesn't use cookies.