W3cubDocs

/Drupal 8

protected function FormState::isRequestMethodSafe

protected FormState::isRequestMethodSafe()

Checks whether the request method is a "safe" HTTP method.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1 defines GET and HEAD as "safe" methods, meaning they SHOULD NOT have side-effects, such as persisting $form_state changes.

Return value

bool

See also

\Symfony\Component\HttpFoundation\Request::isMethodSafe()

File

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

Class

FormState
Stores information about the state of a form.

Namespace

Drupal\Core\Form

Code

protected function isRequestMethodSafe() {
  return in_array($this->requestMethod, array('GET', 'HEAD'));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Form!FormState.php/function/FormState::isRequestMethodSafe/8.1.x