diff --git a/core/includes/theme.inc b/core/includes/theme.inc index dd50e62779ebf4e1ac2de4d383cc4d970d464240..aaa3b74c5c5c83e033455982adf4bae48608b338 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2358,6 +2358,8 @@ function theme_get_suggestions($args, $base, $delimiter = '__') { * @param array $variables * An associative array containing: * - content - An array of page content. + * + * @see system_page_build() */ function template_preprocess_maintenance_page(&$variables) { global $theme; @@ -2424,21 +2426,31 @@ function template_preprocess_maintenance_page(&$variables) { $head_title['slogan'] = strip_tags(filter_xss_admin($site_slogan)); } } - $path = drupal_get_path('module', 'system'); // These are usually added from system_page_build() except maintenance.css. // When the database is inactive it's not called so we add it here. - $default_css = array( - '#attached' => array( - 'css' => array( - $path . '/css/system.module.css', - $path . '/css/system.theme.css', - $path . '/css/system.admin.css', - $path . '/css/system.maintenance.css', - ), - ), + $default_css['library'][] = array('system', 'normalize'); + $path = drupal_get_path('module', 'system'); + // Adjust the weights to load these early. + $default_css['css'][$path . '/css/system.module.css'] = array( + 'weight' => CSS_COMPONENT - 10, + 'every_page' => TRUE, + ); + $default_css['css'][$path . '/css/system.theme.css'] = array( + 'weight' => CSS_SKIN - 10, + 'every_page' => TRUE, + ); + // Unlike regular pages, the admin.css is added for every maintenance page. + $default_css['css'][$path . '/css/system.admin.css'] = array( + 'weight' => CSS_COMPONENT - 10, + 'every_page' => TRUE, + ); + $default_css['css'][$path . '/css/system.maintenance.css'] = array( + 'weight' => CSS_COMPONENT - 10, + 'every_page' => TRUE, ); - drupal_render($default_css); + $attached = array('#attached' => $default_css); + drupal_render($attached); $variables['head_title_array'] = $head_title; $variables['head_title'] = implode(' | ', $head_title); diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 807566cd1567c3cd7988cb21ca07726d7cf98018..96dcd2f90af04c62c55ea67654ab7deeda53916a 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -95,11 +95,6 @@ function _drupal_maintenance_theme() { // Prime the theme registry. // @todo Remove global theme variables. Drupal::service('theme.registry'); - - // These CSS files are normally added by system_page_build(), except - // system.maintenance.css. When the database is inactive, it's not called so - // we add them here. - drupal_add_library('system', 'normalize'); } /** diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 9500adf830a62c2761f495a15957aae235d4def8..c725d8a7a0f05c04bb3300502a39a4f5f2ffb473 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2116,16 +2116,26 @@ function system_filetransfer_info() { /** * Implements hook_page_build(). + * + * @see template_preprocess_maintenance_page() */ function system_page_build(&$page) { - // Note: ensure the same CSS is loaded in _drupal_maintenance_theme(). + // Ensure the same CSS is loaded in template_preprocess_maintenance_page(). $page['#attached']['library'][] = array('system', 'normalize'); $path = drupal_get_path('module', 'system'); // Adjust the weights to load these early. - $page['#attached']['css'][$path . '/css/system.module.css'] = array('weight' => CSS_COMPONENT - 10, 'every_page' => TRUE); - $page['#attached']['css'][$path . '/css/system.theme.css'] = array('weight' => CSS_SKIN - 10, 'every_page' => TRUE); + $page['#attached']['css'][$path . '/css/system.module.css'] = array( + 'weight' => CSS_COMPONENT - 10, + 'every_page' => TRUE, + ); + $page['#attached']['css'][$path . '/css/system.theme.css'] = array( + 'weight' => CSS_SKIN - 10, + 'every_page' => TRUE, + ); if (path_is_admin(current_path())) { - $page['#attached']['css'][$path . '/css/system.admin.css'] = array('weight' => CSS_COMPONENT - 10); + $page['#attached']['css'][$path . '/css/system.admin.css'] = array( + 'weight' => CSS_COMPONENT - 10, + ); } }