setAlwaysProcess example

/** * @covers ::buildForm */
  public function testGetPostAjaxRequest() {
    $request = new Request([FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]['form_id' => 'different_form_id']);
    $request->setMethod('POST');
    $this->requestStack->push($request);

    $form_state = (new FormState())
      ->setUserInput([FormBuilderInterface::AJAX_FORM_REQUEST => TRUE])
      ->setMethod('get')
      ->setAlwaysProcess()
      ->disableRedirect()
      ->set('ajax', TRUE);

    $form_id = '\Drupal\Tests\Core\Form\TestForm';
    $expected_form = (new TestForm())->buildForm([]$form_state);

    $form = $this->formBuilder->buildForm($form_id$form_state);
    $this->assertFormElement($expected_form$form, 'test');
    $this->assertSame('test-form', $form['#id']);
  }

  

  public function setFormState(array $form_state_additions) {
    $this->decoratedFormState->setFormState($form_state_additions);

    return $this;
  }

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

    return $this;
  }

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

  
->shouldBeCalled();

    $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setFormState($form_state_additions));
  }

  /** * @covers ::setAlwaysProcess * * @dataProvider providerSingleBooleanArgument */
  public function testSetAlwaysProcess($always_process) {
    $this->decoratedFormState->setAlwaysProcess($always_process)
      ->shouldBeCalled();

    $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setAlwaysProcess($always_process));
  }

  /** * @covers ::getAlwaysProcess * * @dataProvider providerSingleBooleanArgument */
  public function testGetAlwaysProcess($always_process) {
    

  public function renderExposedForm($block = FALSE) {
    // Deal with any exposed filters we may have, before building.     $form_state = (new FormState())
      ->setStorage([
        'view' => $this->view,
        'display' => &$this->view->display_handler->display,
        'rerender' => TRUE,
      ])
      ->setMethod('get')
      ->setAlwaysProcess()
      ->disableRedirect();

    // Some types of displays (eg. attachments) may wish to use the exposed     // filters of their parent displays instead of showing an additional     // exposed filter form for the attachment as well as that for the parent.     if (!$this->view->display_handler->displaysExposed() || (!$block && $this->view->display_handler->getOption('exposed_block'))) {
      $form_state->set('rerender', NULL);
    }

    if (!empty($this->ajax)) {
      $form_state->set('ajax', TRUE);
    }
Home | Imprint | This part of the site doesn't use cookies.