function EntityController::redirect

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/Controller/EntityController.php \Drupal\Core\Entity\Controller\EntityController::redirect()
  2. 8.9.x core/lib/Drupal/Core/Entity/Controller/EntityController.php \Drupal\Core\Entity\Controller\EntityController::redirect()
  3. 10 core/lib/Drupal/Core/Entity/Controller/EntityController.php \Drupal\Core\Entity\Controller\EntityController::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.

1 call to EntityController::redirect()
EntityController::addPage in core/lib/Drupal/Core/Entity/Controller/EntityController.php
Displays add links for the available bundles.

File

core/lib/Drupal/Core/Entity/Controller/EntityController.php, line 134

Class

EntityController
Provides the add-page and title callbacks for entities.

Namespace

Drupal\Core\Entity\Controller

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.