public function MaintenanceModeSubscriber::onKernelResponse in Maintenance 200 8
Respond to RESPONSE Kernel event by setting status code if in maintenance.
File
- src/
EventSubscriber/ MaintenanceModeSubscriber.php, line 32
Class
Namespace
Drupal\maintenance200\EventSubscriberCode
public function onKernelResponse(FilterResponseEvent $event) {
if ($this->config
->get('maintenance200_enabled')) {
$status_code = $this->config
->get('maintenance200_status_code');
$request = $event
->getRequest();
$routeMatch = RouteMatch::createFromRequest($request);
$response = $event
->getResponse();
if ($this->maintenanceMode
->applies($routeMatch) && !$this->maintenanceMode
->exempt($this->account)) {
$response
->setStatusCode($status_code);
$event
->setResponse($response);
}
}
}