UrlGeneratorTrait::redirect

protected UrlGeneratorTrait::redirect($route_name, array $route_parameters = [], array $options = [], $status = 302)

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.

File

core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php, line 61

Class

UrlGeneratorTrait
Wrapper methods for the Url Generator.

Namespace

Drupal\Core\Routing

Code

protected function redirect($route_name, array $route_parameters = [], array $options = [], $status = 302) {
  $options['absolute'] = TRUE;
  $url = $this->url($route_name, $route_parameters, $options);
  return new RedirectResponse($url, $status);
}
doc_Drupal
2016-10-29 09:51:51
Comments
Leave a Comment

Please login to continue.