function FormState::setCached

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Form/FormState.php \Drupal\Core\Form\FormState::setCached()
  2. 8.9.x core/lib/Drupal/Core/Form/FormState.php \Drupal\Core\Form\FormState::setCached()
  3. 10 core/lib/Drupal/Core/Form/FormState.php \Drupal\Core\Form\FormState::setCached()

Overrides FormStateInterface::setCached

File

core/lib/Drupal/Core/Form/FormState.php, line 547

Class

FormState
Stores information about the state of a form.

Namespace

Drupal\Core\Form

Code

public function setCached($cache = TRUE) {
    // Persisting $form_state is a side-effect disallowed during a "safe" HTTP
    // method.
    if ($cache && $this->isRequestMethodSafe()) {
        throw new \LogicException(sprintf('Form state caching on %s requests is not allowed.', $this->requestMethod));
    }
    $this->cache = (bool) $cache;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.