function MaintenanceMode::applies

Same name in other branches
  1. 9 core/lib/Drupal/Core/Site/MaintenanceMode.php \Drupal\Core\Site\MaintenanceMode::applies()
  2. 10 core/lib/Drupal/Core/Site/MaintenanceMode.php \Drupal\Core\Site\MaintenanceMode::applies()
  3. 11.x core/lib/Drupal/Core/Site/MaintenanceMode.php \Drupal\Core\Site\MaintenanceMode::applies()

Overrides MaintenanceModeInterface::applies

File

core/lib/Drupal/Core/Site/MaintenanceMode.php, line 34

Class

MaintenanceMode
Provides the default implementation of the maintenance mode service.

Namespace

Drupal\Core\Site

Code

public function applies(RouteMatchInterface $route_match) {
    if (!$this->state
        ->get('system.maintenance_mode')) {
        return FALSE;
    }
    if ($route = $route_match->getRouteObject()) {
        if ($route->getOption('_maintenance_access')) {
            return FALSE;
        }
    }
    return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.