executeSubmitHandlers example

->hash_submit(Argument::type('array'), Argument::type(FormStateInterface::class))
      ->shouldBeCalledOnce();
    $mock
      ->submit_handler(Argument::type('array'), Argument::type(FormStateInterface::class))
      ->shouldBeCalledOnce();
    $mock
      ->simple_string_submit(Argument::type('array'), Argument::type(FormStateInterface::class))
      ->shouldBeCalledOnce();

    $form = [];
    $form_state = new FormState();
    $form_submitter->executeSubmitHandlers($form$form_state);

    $form['#submit'][] = [$mock->reveal(), 'hash_submit'];
    $form_submitter->executeSubmitHandlers($form$form_state);

    // $form_state submit handlers will supersede $form handlers.     $form_state->setSubmitHandlers([[$mock->reveal(), 'submit_handler']]);
    $form_submitter->executeSubmitHandlers($form$form_state);

    // Methods directly on the form object can be specified as a string.     $form_state = (new FormState())
      ->setFormObject($mock->reveal())
      


  /** * {@inheritdoc} */
  public function doSubmitForm(&$form, FormStateInterface &$form_state) {
    if (!$form_state->isSubmitted()) {
      return;
    }

    // Execute form submit handlers.     $this->executeSubmitHandlers($form$form_state);

    // If batches were set in the submit handlers, we process them now,     // possibly ending execution. We make sure we do not react to the batch     // that is already being processed (if a batch operation performs a     // \Drupal\Core\Form\FormBuilderInterface::submitForm).     if ($batch = &$this->batchGet() && !isset($batch['current_set'])) {
      // Store $form_state information in the batch definition.       $batch['form_state'] = $form_state;

      $batch['progressive'] = !$form_state->isProgrammed();
      $response = batch_process();
      
/** * {@inheritdoc} */
  public function executeValidateHandlers(&$form, FormStateInterface &$form_state) {
    $this->formValidator->executeValidateHandlers($form$form_state);
  }

  /** * {@inheritdoc} */
  public function executeSubmitHandlers(&$form, FormStateInterface &$form_state) {
    $this->formSubmitter->executeSubmitHandlers($form$form_state);
  }

  /** * {@inheritdoc} */
  public function doSubmitForm(&$form, FormStateInterface &$form_state) {
    throw new \LogicException('Use FormBuilderInterface::processForm() instead.');
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.