You are here

protected function DomainRedirectRequestSubscriber::setResponse in Redirect 8

Prior to set the response it check if we can redirect.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The event object.

\Drupal\Core\Url $url: The Url where we want to redirect.

File

modules/redirect_domain/src/EventSubscriber/DomainRedirectRequestSubscriber.php, line 119

Class

DomainRedirectRequestSubscriber
Redirect subscriber for controller requests.

Namespace

Drupal\redirect_domain\EventSubscriber

Code

protected function setResponse(GetResponseEvent $event, Url $url) {
  $request = $event
    ->getRequest();
  parse_str($request
    ->getQueryString(), $query);
  $url
    ->setOption('query', $query);
  $url
    ->setAbsolute(TRUE);
}