function ThemeSuggestionHooks::maintenancePage

Same name and namespace in other branches
  1. main core/themes/admin/src/Hook/ThemeSuggestionHooks.php \Drupal\admin\Hook\ThemeSuggestionHooks::maintenancePage()

Implements hook_theme_suggestions_HOOK_alter() for maintenance_page.

Attributes

#[Hook('theme_suggestions_maintenance_page_alter')]

File

core/themes/admin/src/Hook/ThemeSuggestionHooks.php, line 60

Class

ThemeSuggestionHooks
Provides theme suggestion hook implementations.

Namespace

Drupal\admin\Hook

Code

public function maintenancePage(array &$suggestions) : void {
  try {
    $is_front = $this->pathMatcher
      ->isFrontPage();
  } catch (\Exception) {
    // An exception could mean that the database is offline. This scenario
    // should also be rendered using the frontpage template.
    $is_front = TRUE;
  }
  if ($is_front) {
    // Add theme suggestion for maintenance page rendered as front page. This
    // allows separating different applications such as update.php from the
    // actual maintenance page.
    $suggestions[] = 'maintenance_page__front';
  }
}

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