function RedirectEventSubscriber::checkRedirectIssued
Checks if a redirect rules action was executed.
Redirects to the provided url if there is one.
Parameters
\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The response event.
File
-
src/
EventSubscriber/ RedirectEventSubscriber.php, line 23
Class
- RedirectEventSubscriber
- Changes the response to a redirect, if a redirect rules action was executed .
Namespace
Drupal\rules\EventSubscriberCode
public function checkRedirectIssued(ResponseEvent $event) {
$request = $event->getRequest();
$redirect_url = $request->attributes
->get('_rules_redirect_action_url');
if (isset($redirect_url)) {
$event->setResponse(new RedirectResponse($redirect_url));
}
}