Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::getRequest()
  2. 9 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.

41 calls to FormBase::getRequest()
BanAdmin::validateForm in core/modules/ban/src/Form/BanAdmin.php
Form validation handler.
BlockContentForm::actions in core/modules/block_content/src/BlockContentForm.php
Returns an array of supported actions for the current entity form.
BlockContentForm::save in core/modules/block_content/src/BlockContentForm.php
Form submission handler for the 'save' action.
BlockEntitySettingTrayForm::form in core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php
Gets the actual form array to be built.
BlockEntitySettingTrayForm::getRedirectUrl in core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php
Gets the form's redirect URL from 'destination' provide in the request.

... 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();
}