You are here

public function MaintenanceModeSubscriber::onKernelRequestMaintenance in uLogin (advanced version) 8

Does something.

Parameters

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

File

src/EventSubscriber/MaintenanceModeSubscriber.php, line 25
Contains \Drupal\ulogin\EventSubscriber\MaintenanceModeSubscriber.

Class

MaintenanceModeSubscriber
Maintenance Mode Subscriber.

Namespace

Drupal\ulogin\EventSubscriber

Code

public function onKernelRequestMaintenance(GetResponseEvent $event) {
  $request = $event
    ->getRequest();
  if ($request->attributes
    ->get('_maintenance') == 4 && \Drupal::currentUser()
    ->isAnonymous() && $request
    ->getPathInfo() == 'ulogin') {

    // Allow access to ulogin path even if site is in offline mode.
    $request->attributes
      ->set('_maintenance', 5);
  }
}