Question

How do I call MaintenanceMode::applies(RouteMatchInterface $route_match) from hook_theme_suggestions_page()?

Was it helpful?

Solution

From a procedural hook you'll probably need to use something like:

use Drupal\Core\Routing\RouteMatch;

...

$maintenance_mode = \Drupal::service('maintenance_mode');
$route_match = RouteMatch::createFromRequest(\Drupal::request());

if ($maintenance_mode->applies($route_match)) {
  // ...
}
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top