You are here

protected function DomainLangConfigRedirect::setRedirectResponse in Domain Lang 8

Sets TrustedRedirectResponse to redirect to related domain page.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The request response event.

string $route: The name of the route.

\Drupal\domain\DomainInterface $domain: The domain object.

1 call to DomainLangConfigRedirect::setRedirectResponse()
DomainLangConfigRedirect::checkRequest in src/EventSubscriber/DomainLangConfigRedirect.php
Check current request and redirect if needed.

File

src/EventSubscriber/DomainLangConfigRedirect.php, line 108

Class

DomainLangConfigRedirect
Redirect subscriber for control language detection and selection pages.

Namespace

Drupal\domain_lang\EventSubscriber

Code

protected function setRedirectResponse(GetResponseEvent $event, $route, DomainInterface $domain) {
  $event
    ->setResponse(new TrustedRedirectResponse(Url::fromRoute($route, [
    'domain' => $domain
      ->id(),
  ], [
    'absolute' => TRUE,
  ])
    ->toString()));
}