diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 080fe8c..a7e4660 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1390,49 +1390,6 @@ function theme_get_suggestions($args, $base, $delimiter = '__') { } /** - * Prepares variables for maintenance page templates. - * - * Default template: maintenance-page.html.twig. - * - * @param array $variables - * An associative array containing: - * - content - An array of page content. - * - * @see system_page_attachments() - */ -function template_preprocess_page__maintenance(&$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 = \Drupal::config('system.site'); - $variables['logo'] = theme_get_setting('logo.url'); - $variables['site_name'] = $site_config->get('name'); - $variables['site_slogan'] = $site_config->get('slogan'); -} - -/** - * Prepares variables for install page templates. - * - * Default template: install-page.html.twig. - * - * @param array $variables - * An associative array containing: - * - content - An array of page content. - * - * @see template_preprocess_page__maintenance() - */ -function template_preprocess_page__maintenance__install(&$variables) { - - // Override the site name that is displayed on the page, since Drupal is - // still in the process of being installed. - $distribution_name = drupal_install_profile_distribution_name(); - $variables['site_name'] = $distribution_name; -} - -/** * Prepares variables for region templates. * * Default template: region.html.twig. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index a8cc12d..3a22a9f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -253,39 +253,71 @@ function system_theme_suggestions_html(array $variables) { * Implements hook_theme_suggestions_HOOK(). */ function system_theme_suggestions_page(array $variables) { - if (\Drupal::service('path.matcher')->isFrontPage()) { - $path_args = ['']; - } - else { - $path_args = explode('/', Url::fromRoute('')->getInternalPath()); - } - return theme_get_suggestions($path_args, 'page'); -} - -/** - * Implements hook_theme_suggestions_HOOK(). - */ -function system_theme_suggestions_maintenance_page(array $variables) { - $suggestions = array(); - // 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(); + if (\Drupal::service('path.matcher')->isFrontPage()) { + $path_args = ['']; + } + else { + $path_args = explode('/', Url::fromRoute('')->getInternalPath()); + } + return theme_get_suggestions($path_args, 'page'); } catch (Exception $e) { // The database is not yet available. $offline = TRUE; } - if ($offline) { - $suggestions[] = 'maintenance_page__offline'; + $suggestions = []; + if (isset($offline) || defined('MAINTENANCE_MODE')) { + $suggestions[] = 'page__maintenance__offline'; } return $suggestions; } /** + * Prepares variables for maintenance page templates. + * + * Default template: page--maintenance.html.twig. + * + * @param array $variables + * An associative array containing: + * - content - An array of page content. + * + * @see system_page_attachments() + */ +function system_preprocess_page__maintenance(&$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 = \Drupal::config('system.site'); + $variables['logo'] = theme_get_setting('logo.url'); + $variables['site_name'] = $site_config->get('name'); + $variables['site_slogan'] = $site_config->get('slogan'); +} + +/** + * Prepares variables for install page templates. + * + * Default template: page--maintenance--install.html.twig. + * + * @param array $variables + * An associative array containing: + * - content - An array of page content. + * + * @see template_preprocess_page__maintenance() + */ +function system_preprocess_page__maintenance__install(&$variables) { + // Override the site name that is displayed on the page, since Drupal is + // still in the process of being installed. + $distribution_name = drupal_install_profile_distribution_name(); + $variables['site_name'] = $distribution_name; +} + +/** * Implements hook_theme_suggestions_HOOK(). */ function system_theme_suggestions_region(array $variables) { @@ -511,11 +543,11 @@ function system_filetransfer_info() { /** * Implements hook_page_attachments(). * - * @see template_preprocess_maintenance_page() + * @see system_preprocess_page__maintenance() * @see \Drupal\Core\EventSubscriber\ActiveLinkResponseFilter */ function system_page_attachments(array &$page) { - // Ensure the same CSS is loaded in template_preprocess_maintenance_page(). + // Ensure the same CSS is loaded in system_preprocess_page__maintenance(). $page['#attached']['library'][] = 'system/base'; if (\Drupal::service('router.admin_context')->isAdminRoute()) { $page['#attached']['library'][] = 'system/admin'; diff --git a/core/themes/bartik/css/maintenance-page.css b/core/themes/bartik/css/maintenance-page.css index dd473d4..f8cc373 100644 --- a/core/themes/bartik/css/maintenance-page.css +++ b/core/themes/bartik/css/maintenance-page.css @@ -1,8 +1,8 @@ -body.maintenance-page { +body.page--maintenance { background-color: #fff; color: #000; } -.maintenance-page #page-wrapper { +.page--maintenance #page-wrapper { background: #fff; margin-left: auto; margin-right: auto; @@ -11,71 +11,71 @@ body.maintenance-page { border: 1px solid #ddd; margin-top: 40px; } -.maintenance-page #page { +.page--maintenance #page { margin: 10px; } -.maintenance-page #main-wrapper { +.page--maintenance #main-wrapper { min-height: inherit; } -.maintenance-page #header, -.maintenance-page #messages { +.page--maintenance #header, +.page--maintenance #messages { width: auto; } -.maintenance-page #main { +.page--maintenance #main { margin: 0; } -.maintenance-page .content .section { +.page--maintenance .content .section { padding: 0 0 0 10px; /* LTR */ } -[dir="rtl"] .maintenance-page .content .section { +[dir="rtl"] .page--maintenance .content .section { padding-left: 0; padding-right: 10px; } -.maintenance-page #header { +.page--maintenance #header { background-color: #fff; background-image: none; } -.maintenance-page .site-branding-text { +.page--maintenance .site-branding-text { margin-bottom: 50px; margin-left: 0; /* LTR */ padding-top: 20px; font-size: 90%; } -[dir="rtl"] .maintenance-page .site-branding-text { +[dir="rtl"] .page--maintenance .site-branding-text { margin-right: 0; } -.maintenance-page .site-branding-text, -.maintenance-page .site-branding-text a, -.maintenance-page .site-branding-text a:hover, -.maintenance-page .site-branding-text a:focus { +.page--maintenance .site-branding-text, +.page--maintenance .site-branding-text a, +.page--maintenance .site-branding-text a:hover, +.page--maintenance .site-branding-text a:focus { color: #777; } -.maintenance-page .page-title { +.page--maintenance .page-title { line-height: 1em; margin-top: 0; } -.maintenance-page #messages { +.page--maintenance #messages { padding: 0; margin-top: 30px; } -.maintenance-page #messages div.messages { +.page--maintenance #messages div.messages { margin: 0; } @media all and (min-width: 800px) { - .maintenance-page #page-wrapper { + .page--maintenance #page-wrapper { width: 800px; } - .maintenance-page #header div.section, - .maintenance-page #main { + .page--maintenance #header div.section, + .page--maintenance #main { width: 700px; } - .maintenance-page #messages div.section { + .page--maintenance #messages div.section { padding: 0; width: auto; } } @media all and (min-width: 600px) { /* @TODO find the proper breakpoint */ - .maintenance-page #page { + .page--maintenance #page { margin: 20px 40px 40px; } } diff --git a/core/themes/seven/css/theme/install-page.css b/core/themes/seven/css/theme/install-page.css index 3a2f217..4558c2f 100644 --- a/core/themes/seven/css/theme/install-page.css +++ b/core/themes/seven/css/theme/install-page.css @@ -3,9 +3,9 @@ * Installation styling. * * Unfortunately we have to make our styling quite strong, to override the - * .maintenance-page styling. + * .page--maintenance styling. */ -.install-page { +.page--maintenance--install { background-color: #1275b2; background-image: url(../../images/noise-low.png), @@ -17,28 +17,28 @@ background-position: left top, 50% 50%; /* LTR */ min-height: 100%; } -[dir="rtl"] .install-page { +[dir="rtl"] .page--maintenance--install { background-position: right top, 50% 50%; } /** * Password widget */ -.install-page .password-parent, -.install-page .confirm-parent { +.page--maintenance--install .password-parent, +.page--maintenance--install .confirm-parent { width: auto; } -.install-page .form-item .password-suggestions { +.page--maintenance--install .form-item .password-suggestions { float: none; width: auto; } -.install-page table td { +.page--maintenance--install table td { word-break: break-word; } @media all and (max-width: 1010px) and (min-width: 48em) { - .install-page .password-strength, - .install-page .confirm-parent { + .page--maintenance--install .password-strength, + .page--maintenance--install .confirm-parent { width: 100%; } .install-configure-form .form-type-password { diff --git a/core/themes/seven/css/theme/maintenance-page.css b/core/themes/seven/css/theme/maintenance-page.css index 6784343..2a37575 100644 --- a/core/themes/seven/css/theme/maintenance-page.css +++ b/core/themes/seven/css/theme/maintenance-page.css @@ -2,7 +2,7 @@ * @file * Maintenance theming. */ -.maintenance-page { +.page--maintenance { background-color: #e0e0d8; background-image: -webkit-radial-gradient(hsl(203, 2%, 90%), hsl(203, 2%, 95%)); background-image: radial-gradient(hsl(203, 2%, 90%), hsl(203, 2%, 95%)); @@ -10,7 +10,7 @@ background-position: left top, 50% 50%; /* LTR */ min-height: 100%; } -[dir="rtl"] .maintenance-page { +[dir="rtl"] .page--maintenance { background-position: right top, 50% 50%; } @@ -129,13 +129,13 @@ html { display: table; } - .install-page, - .maintenance-page { + .page--maintenance--install, + .page--maintenance { display: table-cell; padding: 1em 0; vertical-align: middle; } - html, .install-page, .maintenance-page { + html, .page--maintenance--install, .page--maintenance { margin: 0; width: 100%; height: 100%;