function MaintenanceMode::__construct

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

Constructs a new maintenance mode service.

Parameters

\Drupal\Core\State\StateInterface $state: The state.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

File

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

Class

MaintenanceMode
Provides the default implementation of the maintenance mode service.

Namespace

Drupal\Core\Site

Code

public function __construct(StateInterface $state, ConfigFactoryInterface $config_factory = NULL) {
    $this->state = $state;
    if (!$config_factory) {
        @trigger_error('Calling MaintenanceMode::__construct() without the $config_factory argument is deprecated in drupal:9.4.0 and the $config_factory argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3255815', E_USER_DEPRECATED);
        $config_factory = \Drupal::service('config.factory');
    }
    $this->config = $config_factory;
}

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