function ClaroHooks::themeSuggestionsMaintenancePageAlter

Same name and namespace in other branches
  1. main core/themes/claro/src/Hook/ClaroHooks.php \Drupal\claro\Hook\ClaroHooks::themeSuggestionsMaintenancePageAlter()

Implements hook_theme_suggestions_maintenance_page_alter().

Attributes

#[Hook('theme_suggestions_maintenance_page_alter')]

File

core/themes/claro/src/Hook/ClaroHooks.php, line 334

Class

ClaroHooks
Hook implementations for claro.

Namespace

Drupal\claro\Hook

Code

public function themeSuggestionsMaintenancePageAlter(&$suggestions) : void {
  try {
    $is_front = \Drupal::service('path.matcher')->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.