public function MaintenanceModeSubscriber::onKernelRequestMaintenance

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance()
  2. 8.x drupal/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\user\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance()
  3. 8.x drupal/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\menu_test\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance()

Set the page online if called from a certain path.

Parameters

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

File

drupal/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/EventSubscriber/MaintenanceModeSubscriber.php, line 25
Contains \Drupal\menu_test\EventSubscriber\MaintenanceModeSubscriber.

Class

MaintenanceModeSubscriber
Maintenance mode subscriber to set site online on a test.

Namespace

Drupal\menu_test\EventSubscriber

Code

public function onKernelRequestMaintenance(GetResponseEvent $event) {
  $request = $event
    ->getRequest();

  // Allow access to menu_login_callback even if in maintenance mode.
  if ($request->attributes
    ->get('_maintenance') == MENU_SITE_OFFLINE && $request->attributes
    ->get('system_path') == 'menu_login_callback') {
    $request->attributes
      ->set('_maintenance', MENU_SITE_ONLINE);
  }
}