diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index ed59e8d..c1874e4 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -5,6 +5,8 @@ * Functions to support theming in the Bartik theme. */ +use Drupal\Core\Template\RenderWrapper; + /** * Implements hook_preprocess_HOOK() for html.tpl.php. * @@ -84,8 +86,18 @@ function bartik_preprocess_maintenance_page(&$variables) { if (!$variables['db_is_active']) { $variables['site_name'] = ''; } - drupal_add_css(drupal_get_path('theme', 'bartik') . '/css/maintenance-page.css'); - $variables['styles'] = drupal_get_css(); + $variables['styles'] = new RenderWrapper('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'); // Always print the site name and slogan, but if they are toggled off, we'll @@ -103,6 +115,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' => VERSION, + 'css' => array( + $path . '/css/maintenance-page.css' => array( + 'group' => CSS_AGGREGATE_THEME, + ), + ), + ); + + return $libraries; +} + +/** * Implements hook_preprocess_HOOK() for node.html.twig. */ function bartik_preprocess_node(&$variables) {