You are here

public function AcsfMaintenanceModeSubscriber::onRespond in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 src/EventSubscriber/AcsfMaintenanceModeSubscriber.php \Drupal\acsf\EventSubscriber\AcsfMaintenanceModeSubscriber::onRespond()

Sets SF maintenance mode header (on successful responses).

Parameters

\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The event to process.

File

src/EventSubscriber/AcsfMaintenanceModeSubscriber.php, line 43

Class

AcsfMaintenanceModeSubscriber
Response subscriber to add SF maintenance mode header.

Namespace

Drupal\acsf\EventSubscriber

Code

public function onRespond(FilterResponseEvent $event) {
  if (!$event
    ->isMasterRequest()) {
    return;
  }
  if ($this->state
    ->get('system.maintenance_mode')) {
    $response = $event
      ->getResponse();
    $response->headers
      ->set(self::HEADER, 'enabled');
  }
}