Commit ded8dc77 authored by alexpott's avatar alexpott
Browse files

Issue #2040269 by Tim Bozeman, RunePhilosof, typhonius, Cottser: Remove...

Issue #2040269 by Tim Bozeman, RunePhilosof, typhonius, Cottser: Remove drupal_add_css() from bartik.theme.
parent cf613e22
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Functions to support theming in the Bartik theme. * Functions to support theming in the Bartik theme.
*/ */
use Drupal\Core\Template\RenderWrapper;
/** /**
* Implements hook_preprocess_HOOK() for html.tpl.php. * Implements hook_preprocess_HOOK() for html.tpl.php.
* *
...@@ -84,8 +86,18 @@ function bartik_preprocess_maintenance_page(&$variables) { ...@@ -84,8 +86,18 @@ function bartik_preprocess_maintenance_page(&$variables) {
if (!$variables['db_is_active']) { if (!$variables['db_is_active']) {
$variables['site_name'] = ''; $variables['site_name'] = '';
} }
drupal_add_css(drupal_get_path('theme', 'bartik') . '/css/maintenance-page.css'); $variables['styles'] = new RenderWrapper('drupal_get_css');
$variables['styles'] = drupal_get_css(); // Normally we could attach libraries via hook_page_alter(), but when the
// database is inactive it's not called so we add them here.
$libraries = array(
'#attached' => array(
'library' => array(
array('bartik', 'maintenance_page'),
),
),
);
drupal_render($libraries);
$site_config = \Drupal::config('system.site'); $site_config = \Drupal::config('system.site');
// Always print the site name and slogan, but if they are toggled off, we'll // Always print the site name and slogan, but if they are toggled off, we'll
...@@ -102,6 +114,23 @@ function bartik_preprocess_maintenance_page(&$variables) { ...@@ -102,6 +114,23 @@ function bartik_preprocess_maintenance_page(&$variables) {
} }
} }
/**
* Implements hook_library_info().
*/
function bartik_library_info() {
$path = drupal_get_path('theme', 'bartik');
$libraries['maintenance_page'] = array(
'version' => \DRUPAL::VERSION,
'css' => array(
$path . '/css/maintenance-page.css' => array(
'group' => CSS_AGGREGATE_THEME,
),
),
);
return $libraries;
}
/** /**
* Implements hook_preprocess_HOOK() for node.html.twig. * Implements hook_preprocess_HOOK() for node.html.twig.
*/ */
......
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