class MaintenanceModeSubscriber in uLogin (advanced version) 8
Maintenance Mode Subscriber.
Hierarchy
- class \Drupal\ulogin\EventSubscriber\MaintenanceModeSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of MaintenanceModeSubscriber
1 string reference to 'MaintenanceModeSubscriber'
1 service uses MaintenanceModeSubscriber
File
- src/
EventSubscriber/ MaintenanceModeSubscriber.php, line 17 - Contains \Drupal\ulogin\EventSubscriber\MaintenanceModeSubscriber.
Namespace
Drupal\ulogin\EventSubscriberView source
class MaintenanceModeSubscriber implements EventSubscriberInterface {
/**
* Does something.
*
* @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
* The event to process.
*/
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);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[KernelEvents::REQUEST][] = [
'onKernelRequestMaintenance',
35,
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MaintenanceModeSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
MaintenanceModeSubscriber:: |
public | function | Does something. |