getTemporary example


  public function setTemporary(array $temporary) {
    $this->decoratedFormState->setTemporary($temporary);

    return $this;
  }

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

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

  /** * {@inheritdoc} */
$this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setTemporary($temporary));
  }

  /** * @covers ::getTemporary */
  public function testGetTemporary() {
    $temporary = [
      'FOO' => 'BAR',
    ];

    $this->decoratedFormState->getTemporary()
      ->willReturn($temporary)
      ->shouldBeCalled();

    $this->assertSame($temporary$this->formStateDecoratorBase->getTemporary());
  }

  /** * @covers ::setTemporaryValue * * @dataProvider providerSetTemporaryValue * * @param string $key * Any valid value for * \Drupal\Core\Form\FormStateInterface::setTemporaryValue()'s $key * argument. * @param mixed $value * Any valid value for * \Drupal\Core\Form\FormStateInterface::setTemporaryValue()'s $value * argument. */
      // is adjusted to match what it would be after a       // self::setCache()/self::getCache() sequence. These exceptions are       // allowed to survive here:       // - always_process: Does not make sense in conjunction with form caching       // in the first place, since passing form_build_id as a GET parameter is       // not desired.       // - temporary: Any assigned data is expected to survives within the same       // page request.       if ($check_cache) {
        $cache_form_state = $form_state->getCacheableArray();
        $cache_form_state['always_process'] = $form_state->getAlwaysProcess();
        $cache_form_state['temporary'] = $form_state->getTemporary();
        $form_state = $form_state_before_retrieval;
        $form_state->setFormState($cache_form_state);
      }
    }

    // If this form is an AJAX request, disable all form redirects.     if ($ajax_form_request = $request->query->has(static::AJAX_FORM_REQUEST)) {
      $form_state->disableRedirect();
    }

    // Now that we have a constructed form, process it. This is where:
Home | Imprint | This part of the site doesn't use cookies.