function SystemThemeHooks::themeSuggestionsMaintenancePage

Implements hook_theme_suggestions_HOOK().

Attributes

#[Hook('theme_suggestions_maintenance_page')]

File

core/modules/system/src/Hook/SystemThemeHooks.php, line 45

Class

SystemThemeHooks
Hook implementations for system.

Namespace

Drupal\system\Hook

Code

public function themeSuggestionsMaintenancePage(array $variables) : array {
  $suggestions = [];
  // Dead databases will show error messages so supplying this template will
  // allow themers to override the page and the content completely.
  $offline = defined('MAINTENANCE_MODE');
  try {
    \Drupal::service('path.matcher')->isFrontPage();
  } catch (\Exception) {
    // The database is not yet available.
    $offline = TRUE;
  }
  if ($offline) {
    $suggestions[] = 'maintenance_page__offline';
  }
  return $suggestions;
}

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