diff --git a/core/core.library.yml b/core/core.library.yml index fb60744..bd44d88 100644 --- a/core/core.library.yml +++ b/core/core.library.yml @@ -65,7 +65,7 @@ drupal.autocomplete: drupal.batch: version: VERSION js: - misc/batch.js: { group: 0, cache: false } + misc/batch.js: { cache: false } dependencies: - core/jquery - core/drupal @@ -77,7 +77,7 @@ drupal.batch: drupal.collapse: version: VERSION js: - misc/collapse.js: { group: 0 } + misc/collapse.js: {} dependencies: - core/jquery - core/modernizr @@ -164,7 +164,7 @@ drupal.machine-name: drupal.progress: version: VERSION js: - misc/progress.js: { group: 0 } + misc/progress.js: {} dependencies: - core/drupal - core/jquery diff --git a/core/includes/common.inc b/core/includes/common.inc index 1b434b7..d05f4fb 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2769,13 +2769,16 @@ function drupal_get_library($extension, $name = NULL) { $libraries[$extension] = array(); if ($extension === 'core') { $path = 'core'; + $extension_type = 'core'; } else { // @todo Add a $type argument OR automatically figure out the type based // on current extension data, possibly using a module->theme fallback. $path = drupal_get_path('module', $extension); + $extension_type = 'module'; if (!$path) { $path = drupal_get_path('theme', $extension); + $extension_type = 'theme'; } } $library_file = DRUPAL_ROOT . '/' . $path . '/' . $extension . '.library.yml'; @@ -2809,10 +2812,16 @@ function drupal_get_library($extension, $name = NULL) { if (!is_array($options)) { $options = array(); } - // Apply the JS_LIBRARY group if it wasn't explicitly set. - if (!isset($options['group']) && $type == 'js') { + // Unconditionally apply default groups for the defined asset files. + // The library system is a dependency management system. Each library + // properly specifies its dependencies instead of relying on a custom + // processing order. + if ($type == 'js') { $options['group'] = JS_LIBRARY; } + elseif ($type == 'css') { + $options['group'] = $extension_type == 'module' ? CSS_AGGREGATE_DEFAULT : CSS_AGGREGATE_THEME; + } // By default, all library assets are files. if (!isset($options['type'])) { $options['type'] = 'file'; diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 46bd850..3dee6af 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2412,25 +2412,9 @@ function template_preprocess_maintenance_page(&$variables) { // 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['library'][] = array('core', '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, - ); + $default_css['library'][] = array('system', 'base'); + $default_css['library'][] = array('system', 'admin'); + $default_css['library'][] = array('system', 'maintenance'); $attached = array('#attached' => $default_css); drupal_render($attached); diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php index 73523fd..8375549 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -250,14 +250,6 @@ public function settingsFormSubmit(array $form, array &$form_state) { /** * {@inheritdoc} */ - public function getGlobalJSSettings(EditorEntity $editor) { - $settings['ckeditor']['modulePath'] = drupal_get_path('module', 'ckeditor'); - return $settings; - } - - /** - * {@inheritdoc} - */ public function getJSSettings(EditorEntity $editor) { $settings = array(); diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module index 5291bb7..aee37af 100644 --- a/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -55,7 +55,9 @@ function edit_page_build(&$page) { function edit_library_info_alter(&$libraries, $module) { if ($module == 'edit') { $css = _edit_theme_css(); - $libraries['edit']['css'] = array_merge($libraries['edit']['css'], $css); + foreach ($css as $css_file) { + $libraries['edit']['css'][$css_file] = array(); + } } } @@ -136,7 +138,7 @@ function _edit_theme_css($theme = NULL) { if (isset($info['edit_stylesheets'])) { $css = $info['edit_stylesheets']; foreach ($css as $key => $path) { - $css[$key] = array('type' => 'file', 'data' => $theme_path . '/' . $path); + $css[$key] = '/' . $theme_path . '/' . $path; } } if (isset($info['base theme'])) { diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorBase.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorBase.php index db616da..5610d33 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorBase.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorBase.php @@ -65,11 +65,4 @@ public function settingsFormValidate(array $form, array &$form_state) { public function settingsFormSubmit(array $form, array &$form_state) { } - /** - * {@inheritdoc} - */ - public function getGlobalJSSettings(Editor $editor) { - return array(); - } - } diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php index 4ae77b6..3114e3a 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php @@ -65,7 +65,6 @@ public function getAttachments(array $format_ids) { $attachments = array('library' => array()); $settings = array(); - $global_settings_processed = array(); foreach ($format_ids as $format_id) { $editor = editor_load($format_id); if (!$editor) { @@ -77,16 +76,6 @@ public function getAttachments(array $format_ids) { // Libraries. $attachments['library'] = array_merge($attachments['library'], $plugin->getLibraries($editor)); - // Global, format-agnostic JavaScript settings. - if (!isset($global_settings_processed[$editor->editor])) { - if ($global_settings = $plugin->getGlobalJSSettings($editor)) { - // Prevent editors from manipulating Editor module settings. - unset($global_settings['editor']); - $settings = array_merge($settings, $global_settings); - } - $global_settings_processed[$editor->editor] = TRUE; - } - // Format-specific JavaScript settings. $settings['editor']['formats'][$format_id] = array( 'format' => $format_id, diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorPluginInterface.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorPluginInterface.php index affc7d3..99b6a13 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorPluginInterface.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorPluginInterface.php @@ -75,24 +75,6 @@ public function settingsFormValidate(array $form, array &$form_state); public function settingsFormSubmit(array $form, array &$form_state); /** - * Returns global JavaScript settings to be attached. - * - * Allows text editors to expose global settings (independent of text format) - * as JavaScript variables in drupalSettings. - * - * @param \Drupal\editor\Entity\Editor $editor - * A configured text editor object. - * - * @return array - * An array of settings that will be added to the page for use by this text - * editor's JavaScript integration. - * - * @see drupal_process_attached() - * @see EditorManager::getAttachments() - */ - public function getGlobalJSSettings(Editor $editor); - - /** * Returns JavaScript settings to be attached. * * Most text editors use JavaScript to provide a WYSIWYG or toolbar on the diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php index 299a6f2..b3ba306 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php @@ -87,13 +87,6 @@ public function getAttachments() { // Also include editor.module's formatted text editor. $attachments['library'][] = array('editor', 'edit.inPlaceEditor.formattedText'); - $attachments['js'][] = array( - 'type' => 'setting', - 'data' => array( - 'editor' => array('getUntransformedTextURL' => url('editor/!entity_type/!id/!field_name/!langcode/!view_mode'), - ), - ), - ); return $attachments; } diff --git a/core/modules/picture/picture.library.yml b/core/modules/picture/picture.library.yml index f84ed26..695fae7 100644 --- a/core/modules/picture/picture.library.yml +++ b/core/modules/picture/picture.library.yml @@ -5,6 +5,6 @@ picturefill: # @see https://drupal.org/node/1775530 version: VERSION js: - picturefill/picturefill.js: { weight: -10, group: 0 } + picturefill/picturefill.js: { weight: -10 } dependencies: - core/matchmedia diff --git a/core/modules/system/system.library.yml b/core/modules/system/system.library.yml index 8deb657..90c67d1 100644 --- a/core/modules/system/system.library.yml +++ b/core/modules/system/system.library.yml @@ -1,3 +1,27 @@ +base: + version: VERSION + css: + # Adjust the weights to load these early. + css/system.module.css: { every_page: true, weight: -10, } + css/system.theme.css: { every_page: true, weight: 190 } + dependencies: + - core/normalize + +admin: + version: VERSION + css: + css/system.admin.css: { weight: -10 } + dependencies: + - system/base + +maintenance: + version: VERSION + css: + css/system.maintenance.css: { weight: -10 } + dependencies: + - system/base + - system/admin + drupal.system: version: VERSION js: diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 2246dc1..302ef6f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1103,20 +1103,9 @@ function system_filetransfer_info() { function system_page_build(&$page) { // Ensure the same CSS is loaded in template_preprocess_maintenance_page(). $page['#attached']['library'][] = array('core', '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']['library'][] = array('system', 'base'); if (path_is_admin(current_path())) { - $page['#attached']['css'][$path . '/css/system.admin.css'] = array( - 'weight' => CSS_COMPONENT - 10, - ); + $page['#attached']['library'][] = array('system', 'admin'); } } diff --git a/core/modules/views/views.library.yml b/core/modules/views/views.library.yml index 7391d1b..fe5f75d 100644 --- a/core/modules/views/views.library.yml +++ b/core/modules/views/views.library.yml @@ -6,8 +6,8 @@ views.module: views.ajax: version: VERSION js: - js/base.js: { group: 0 } - js/ajax_view.js: { group: 0 } + js/base.js: {} + js/ajax_view.js: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/views_ui/views_ui.library.yml b/core/modules/views_ui/views_ui.library.yml index 410609f..cf92482 100644 --- a/core/modules/views_ui/views_ui.library.yml +++ b/core/modules/views_ui/views_ui.library.yml @@ -1,9 +1,9 @@ views_ui.admin: version: VERSION js: - js/ajax.js: { group: 0 } - js/dialog.views.js: { group: 0 } - js/views-admin.js: { group: 0 } + js/ajax.js: {} + js/dialog.views.js: {} + js/views-admin.js: {} dependencies: - core/jquery - core/drupal @@ -16,4 +16,8 @@ views_ui.admin: views_ui.listing: version: VERSION js: - js/views_ui.listing.js: { group: 0 } + js/views_ui.listing.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once diff --git a/core/themes/bartik/bartik.library.yml b/core/themes/bartik/bartik.library.yml index c4e3622..71f85d4 100644 --- a/core/themes/bartik/bartik.library.yml +++ b/core/themes/bartik/bartik.library.yml @@ -1,4 +1,6 @@ maintenance_page: version: VERSION css: - css/maintenance-page.css: { group: 100 } + css/maintenance-page.css: {} + dependencies: + - system/maintenance diff --git a/core/themes/seven/seven.library.yml b/core/themes/seven/seven.library.yml index ff12caa..fd01adc 100644 --- a/core/themes/seven/seven.library.yml +++ b/core/themes/seven/seven.library.yml @@ -1,6 +1,8 @@ install-page: version: VERSION js: - js/mobile.install.js: { group: 100 } + js/mobile.install.js: {} css: - install-page.css: { group: 100 } + install-page.css: {} + dependencies: + - system/maintenance diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index 202f202..89d7c8b 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -197,13 +197,7 @@ function seven_preprocess_install_page(&$variables) { // 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('seven', 'install-page'), - ), - ), - ); + $libraries['#attached']['library'][] = array('seven', 'install-page'); drupal_render($libraries); }