Commit a3d88883 authored by webchick's avatar webchick

Issue #2008270 by typhonius, mcjim, Wim Leers, vijaycs85, mr.baileys,...

Issue #2008270 by typhonius, mcjim, Wim Leers, vijaycs85, mr.baileys, JohnAlbin: Remove drupal_add_css() from template_preprocess_maintenance_page() — use #attached.
parent 3f19bff6
......@@ -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);
......
......@@ -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');
}
/**
......
......@@ -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,
);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment