function FormBase::redirect

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

Returns a redirect response object for the specified route.

Parameters

string $route_name: The name of the route to which to redirect.

array $route_parameters: (optional) Parameters for the route.

array $options: (optional) An associative array of additional options.

int $status: (optional) The HTTP redirect status code for the redirect. The default is 302 Found.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect response object that may be returned by the controller.

Overrides UrlGeneratorTrait::redirect

8 calls to FormBase::redirect()
IdConflictForm::buildForm in core/modules/migrate_drupal_ui/src/Form/IdConflictForm.php
Form constructor.
MigrateUpgradeFormBase::restartUpgradeForm in core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php
Helper to redirect to the Overview form.
ModulesListConfirmForm::buildForm in core/modules/system/src/Form/ModulesListConfirmForm.php
Form constructor.
ModulesUninstallConfirmForm::buildForm in core/modules/system/src/Form/ModulesUninstallConfirmForm.php
Form constructor.
OverviewForm::buildForm in core/modules/migrate_drupal_ui/src/Form/OverviewForm.php
Form constructor.

... See full list

File

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

Class

FormBase
Provides a base class for forms.

Namespace

Drupal\Core\Form

Code

protected function redirect($route_name, array $route_parameters = [], array $options = [], $status = 302) {
    $options['absolute'] = TRUE;
    return new RedirectResponse(Url::fromRoute($route_name, $route_parameters, $options)->toString(), $status);
}

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