function FormBase::getRequest

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::getRequest()
  2. 10 core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::getRequest()
  3. 11.x core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::getRequest()

Gets the request object.

Return value

\Symfony\Component\HttpFoundation\Request The request object.

8 calls to FormBase::getRequest()
AccountForm::form in core/modules/user/src/AccountForm.php
Gets the actual form array to be built.
ConfirmFormBase::buildForm in core/lib/Drupal/Core/Form/ConfirmFormBase.php
Form constructor.
ContentEntityConfirmFormBase::actions in core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php
Returns an array of supported actions for the current entity form.
EntityConfirmFormBase::actions in core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
Returns an array of supported actions for the current entity form.
FieldConfigEditForm::save in core/modules/field_ui/src/Form/FieldConfigEditForm.php
Form submission handler for the 'save' action.

... See full list

File

core/lib/Drupal/Core/Form/FormBase.php, line 153

Class

FormBase
Provides a base class for forms.

Namespace

Drupal\Core\Form

Code

protected function getRequest() {
    if (!$this->requestStack) {
        $this->requestStack = \Drupal::service('request_stack');
    }
    return $this->requestStack
        ->getCurrentRequest();
}

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