function ThemePreprocess::preprocessMaintenancePage

Prepares variables for maintenance page templates.

Default template: maintenance-page.html.twig.

Parameters

array $variables: An associative array containing:

  • content - An array of page content.

See also

system_page_attachments()

1 call to ThemePreprocess::preprocessMaintenancePage()
ThemePreprocess::preprocessInstallPage in core/lib/Drupal/Core/Theme/ThemePreprocess.php
Prepares variables for install page templates.

File

core/lib/Drupal/Core/Theme/ThemePreprocess.php, line 373

Class

ThemePreprocess
Preprocess for common/core theme templates.

Namespace

Drupal\Core\Theme

Code

public function preprocessMaintenancePage(array &$variables) : void {
  // @todo Rename the templates to page--maintenance + page--install.
  $this->preprocessPage($variables);
  // @see system_page_attachments()
  $variables['#attached']['library'][] = 'system/maintenance';
  // Maintenance page and install page need branding info in variables because
  // there is no blocks.
  $site_config = $this->configFactory
    ->get('system.site');
  $variables['logo'] = theme_get_setting('logo.url');
  $variables['site_name'] = $site_config->get('name');
  $variables['site_slogan'] = $site_config->get('slogan');
  // Maintenance page and install page need page title in variable because
  // there are no blocks.
  $variables['title'] = $variables['page']['#title'];
}

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