class MaintenanceMode in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Site/MaintenanceMode.php \Drupal\Core\Site\MaintenanceMode
Provides the default implementation of the maintenance mode service.
Hierarchy
- class \Drupal\Core\Site\MaintenanceMode implements MaintenanceModeInterface
Expanded class hierarchy of MaintenanceMode
1 string reference to 'MaintenanceMode'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses MaintenanceMode
File
- core/
lib/ Drupal/ Core/ Site/ MaintenanceMode.php, line 17 - Contains \Drupal\Core\Site\MaintenanceMode.
Namespace
Drupal\Core\SiteView source
class MaintenanceMode implements MaintenanceModeInterface {
/**
* The state.
*
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* Constructs a new maintenance mode service.
*
* @param \Drupal\Core\State\StateInterface $state
* The state.
*/
public function __construct(StateInterface $state) {
$this->state = $state;
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function exempt(AccountInterface $account) {
return $account
->hasPermission('access site in maintenance mode');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MaintenanceMode:: |
protected | property | The state. | |
MaintenanceMode:: |
public | function |
Returns whether the site is in maintenance mode. Overrides MaintenanceModeInterface:: |
|
MaintenanceMode:: |
public | function |
Determines whether a user has access to the site in maintenance mode. Overrides MaintenanceModeInterface:: |
|
MaintenanceMode:: |
public | function | Constructs a new maintenance mode service. |