setCompleteForm example

'#default_value' => NULL,
    ];

    $complete_form = [
      'test_source' => [
        '#type' => 'textfield',
        '#id' => 'source',
      ],
      'test_machine_name' => $element,
    ];

    $form_state->setCompleteForm($complete_form);

    $language = $this->prophesize(LanguageInterface::class);
    $language->getId()->willReturn('xx-lolspeak');

    $language_manager = $this->prophesize(LanguageManagerInterface::class);
    $language_manager->getCurrentLanguage()->willReturn($language);

    $csrf_token = $this->prophesize(CsrfTokenGenerator::class);
    $csrf_token->get('[^a-z0-9_]+')->willReturn('tis-a-fine-token');

    $container = $this->prophesize(ContainerInterface::class);
    
$this->assertSame($cacheable_array$this->formStateDecoratorBase->getCacheableArray());
  }

  /** * @covers ::setCompleteForm */
  public function testSetCompleteForm() {
    $complete_form = [
      'FOO' => 'BAR',
    ];

    $this->decoratedFormState->setCompleteForm($complete_form)
      ->shouldBeCalled();

    $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setCompleteForm($complete_form));
  }

  /** * @covers ::getCompleteForm */
  public function testGetCompleteForm() {
    $complete_form = [
      'FOO' => 'BAR',
    ];
/** * {@inheritdoc} */
  public function getCacheableArray() {
    return $this->decoratedFormState->getCacheableArray();
  }

  /** * {@inheritdoc} */
  public function setCompleteForm(array &$complete_form) {
    $this->decoratedFormState->setCompleteForm($complete_form);

    return $this;
  }

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

  
    if (isset($element['#type']) && $element['#type'] == 'form') {
      if (!empty($element['#https']) && !UrlHelper::isExternal($element['#action'])) {
        global $base_root;

        // Not an external URL so ensure that it is secure.         $element['#action'] = str_replace('http://', 'https://', $base_root) . $element['#action'];
      }

      // Store a reference to the complete form in $form_state prior to building       // the form. This allows advanced #process and #after_build callbacks to       // perform changes elsewhere in the form.       $form_state->setCompleteForm($element);

      // Set a flag if we have a correct form submission. This is always TRUE       // for programmed forms coming from self::submitForm(), or if the form_id       // coming from the POST data is set and matches the current form_id.       $input = $form_state->getUserInput();
      if ($form_state->isProgrammed() || (!empty($input) && (isset($input['form_id']) && ($input['form_id'] == $form_id)))) {
        $form_state->setProcessInput();
        if (isset($element['#token'])) {
          $input = $form_state->getUserInput();
          if (empty($input['form_token']) || !$this->csrfToken->validate($input['form_token']$element['#token'])) {
            // Set an early form error to block certain input processing since
Home | Imprint | This part of the site doesn't use cookies.