From a68a2e239b2279927ba3ca8d827bd3fa4ecb25eb Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Tue, 3 Dec 2013 22:42:42 -0800 Subject: [PATCH] Issue #2095311 by Wim Leers: Remove drupal_add_css() from update.module. --- core/modules/update/update.manager.inc | 2 +- core/modules/update/update.module | 17 +++++++++++++++++ core/modules/update/update.report.inc | 11 ++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index a257685e86a6..19c0dc19abb9 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -82,7 +82,7 @@ function update_manager_update_form($form, $form_state = array(), $context) { return $form; } - $form['#attached']['css'][] = drupal_get_path('module', 'update') . '/css/update.admin.css'; + $form['#attached']['library'][] = array('update', 'drupal.update.admin'); // This will be a nested array. The first key is the kind of project, which // can be either 'enabled', 'disabled', 'manual' (projects which require diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 4cf9c0dfa8e5..af8143b11a3d 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -144,6 +144,23 @@ function update_page_build() { } } +/** + * Implements hook_library_info(). + */ +function update_library_info() { + $path = drupal_get_path('module', 'update'); + $libraries['drupal.update.admin'] = array( + 'title' => 'Update administration UI', + 'website' => '', + 'version' => \Drupal::VERSION, + 'css' => array( + $path . '/css/update.admin.css' => array(), + ), + ); + + return $libraries; +} + /** * Implements hook_menu(). */ diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 039a506b211c..51da7dd18158 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -293,7 +293,16 @@ function theme_update_report($variables) { $output .= drupal_render($table); } } - drupal_add_css(drupal_get_path('module', 'update') . '/css/update.admin.css'); + + $assets = array( + '#attached' => array( + 'library' => array( + array('update', 'drupal.update.admin'), + ), + ) + ); + drupal_render($assets); + return $output; } -- GitLab