Commit f19fadd3 authored by webchick's avatar webchick

Issue #1996238 by sun, nod_, damiankloip, Wim Leers, longwave, alexpott, Xano,...

Issue #1996238 by sun, nod_, damiankloip, Wim Leers, longwave, alexpott, Xano, mdrummond, Mark Carver, Jeff Burnz, highrockmedia, joelpittet, et al: Replace hook_library_info() by *.libraries.yml file.
parent b673b60b
This diff is collapsed.
......@@ -480,8 +480,8 @@ function ajax_pre_render_element($element) {
// Attach JavaScript settings to the element.
if (isset($element['#ajax']['event'])) {
$element['#attached']['library'][] = array('system', 'jquery.form');
$element['#attached']['library'][] = array('system', 'drupal.ajax');
$element['#attached']['library'][] = array('core', 'jquery.form');
$element['#attached']['library'][] = array('core', 'drupal.ajax');
$settings = $element['#ajax'];
......
......@@ -191,7 +191,7 @@ function _batch_progress_page() {
),
),
'library' => array(
array('system', 'drupal.batch'),
array('core', 'drupal.batch'),
),
),
);
......
This diff is collapsed.
......@@ -1647,7 +1647,7 @@ function theme_tableselect($variables) {
// checkboxes/radios in the first table column.
if ($element['#js_select']) {
// Add a "Select all" checkbox.
$table['#attached']['library'][] = array('system', 'drupal.tableselect');
$table['#attached']['library'][] = array('core', 'drupal.tableselect');
array_unshift($header, array('class' => array('select-all')));
}
else {
......@@ -1769,7 +1769,7 @@ function form_process_table($element, &$form_state) {
// Add a "Select all" checkbox column to the header.
// @todo D8: Rename into #select_all?
if ($element['#js_select']) {
$element['#attached']['library'][] = array('system', 'drupal.tableselect');
$element['#attached']['library'][] = array('core', 'drupal.tableselect');
array_unshift($element['#header'], array('class' => array('select-all')));
}
// Add an empty header column for radio buttons or when a "Select all"
......@@ -1969,7 +1969,7 @@ function form_process_machine_name($element, &$form_state) {
'langcode' => $language->id,
),
);
$element['#attached']['library'][] = array('system', 'drupal.machine-name');
$element['#attached']['library'][] = array('core', 'drupal.machine-name');
$element['#attached']['js'][] = $js_settings;
return $element;
......@@ -2062,7 +2062,7 @@ function form_pre_render_details($element) {
_form_set_attributes($element, array('form-wrapper'));
// Collapsible details.
$element['#attached']['library'][] = array('system', 'drupal.collapse');
$element['#attached']['library'][] = array('core', 'drupal.collapse');
if (empty($element['#collapsed'])) {
$element['#attributes']['open'] = 'open';
}
......@@ -2116,7 +2116,7 @@ function form_pre_render_group($element) {
if (isset($element['#group'])) {
// Contains form element summary functionalities.
$element['#attached']['library'][] = array('system', 'drupal.form');
$element['#attached']['library'][] = array('core', 'drupal.form');
$group = $element['#group'];
// If this element belongs to a group, but the group-holding element does
......@@ -2165,7 +2165,7 @@ function form_process_vertical_tabs($element, &$form_state) {
$element['#title_display'] = 'invisible';
}
$element['#attached']['library'][] = array('system', 'drupal.vertical-tabs');
$element['#attached']['library'][] = array('core', 'drupal.vertical-tabs');
// The JavaScript stores the currently selected tab in this hidden
// field so that the active tab can be restored the next time the
......@@ -2255,7 +2255,7 @@ function form_process_autocomplete($element, &$form_state) {
}
if ($access) {
$element['#attributes']['class'][] = 'form-autocomplete';
$element['#attached']['library'][] = array('system', 'drupal.autocomplete');
$element['#attached']['library'][] = array('core', 'drupal.autocomplete');
// Provide a data attribute for the JavaScript behavior to bind to.
$element['#attributes']['data-autocomplete-path'] = $path;
}
......
......@@ -2079,7 +2079,7 @@ function install_configure_form($form, &$form_state, &$install_state) {
$form['#attached']['library'][] = array('system', 'drupal.system');
// Add JavaScript time zone detection.
$form['#attached']['library'][] = array('system', 'drupal.timezone');
$form['#attached']['library'][] = array('core', 'drupal.timezone');
// We add these strings as settings because JavaScript translation does not
// work during installation.
$js = array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail')));
......
......@@ -5,6 +5,7 @@
* API for loading and interacting with Drupal modules.
*/
use Drupal\Core\Cache\Cache;
/**
* Builds a list of bootstrap modules and enabled modules and themes.
......@@ -112,6 +113,13 @@ function system_list_reset() {
drupal_static_reset('list_themes');
\Drupal::cache('bootstrap')->delete('system_list');
\Drupal::cache()->delete('system_info');
// Clear the library info cache.
// Libraries may be provided by all extension types, and may be altered by any
// other extensions (types) due to the nature of drupal_alter() and the fact
// that profiles are recorded and handled as modules.
Cache::invalidateTags(array('extension' => TRUE));
// Remove last known theme data state.
// This causes system_list() to call system_rebuild_theme_data() on its next
// invocation. When enabling a module that implements hook_system_info_alter()
......
......@@ -1590,7 +1590,7 @@ function theme_table($variables) {
// Add sticky headers, if applicable.
if (count($header) && $sticky) {
drupal_add_library('system', 'drupal.tableheader');
drupal_add_library('core', 'drupal.tableheader');
// Add 'sticky-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'][] = 'sticky-enabled';
......@@ -1599,7 +1599,7 @@ function theme_table($variables) {
// with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM
// and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors.
if (count($header) && $responsive) {
drupal_add_library('system', 'drupal.tableresponsive');
drupal_add_library('core', 'drupal.tableresponsive');
// Add 'responsive-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'][] = 'responsive-enabled';
......@@ -2157,7 +2157,7 @@ function template_preprocess_html(&$variables) {
drupal_add_html_head($element, $name);
}
drupal_add_library('system', 'html5shiv', TRUE);
drupal_add_library('core', 'html5shiv', TRUE);
$variables['page_top'][] = array('#markup' => $page->getBodyTop());
$variables['page_bottom'][] = array('#markup' => $page->getBodyBottom());
......@@ -2431,26 +2431,8 @@ 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('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,
);
$default_css['library'][] = array('core', 'normalize');
$default_css['library'][] = array('system', 'maintenance');
$attached = array('#attached' => $default_css);
drupal_render($attached);
$variables['messages'] = array(
......
......@@ -124,7 +124,7 @@ public function setDialogTitle($title) {
*/
public function render() {
// Add the library for handling the dialog in the response.
drupal_add_library('system', 'drupal.dialog.ajax');
drupal_add_library('core', 'drupal.dialog.ajax');
// For consistency ensure the modal option is set to TRUE or FALSE.
$this->dialogOptions['modal'] = isset($this->dialogOptions['modal']) && $this->dialogOptions['modal'];
......
/**
* Drupal's batch API.
*/
(function ($, Drupal) {
"use strict";
......
/**
* Manages elements that can offset the size of the viewport.
*
* Measures and reports viewport offset dimensions from elements like the
* toolbar that can potentially displace the positioning of other elements.
*/
(function ($, Drupal, debounce) {
......
/**
* Base framework for Drupal-specific JavaScript, behaviors, and settings.
*/
window.Drupal = { behaviors: {}, locale: {} };
// Class indicating that JS is enabled; used for styling purpose.
......
/**
* Drupal's states library.
*/
(function ($) {
"use strict";
......
drupal.block:
version: VERSION
js:
block.js: {}
dependencies:
- core/jquery
- core/drupal
drupal.block.admin:
version: VERSION
js:
js/block.admin.js: {}
css:
theme:
css/block.admin.css: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.ajax
......@@ -547,37 +547,3 @@ function block_language_delete($language) {
}
}
}
/**
* Implements hook_library_info().
*/
function block_library_info() {
$libraries['drupal.block'] = array(
'title' => 'Block',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'block') . '/block.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
),
);
$libraries['drupal.block.admin'] = array(
'title' => 'Block admin',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'block') . '/js/block.admin.js' => array(),
),
'css' => array(
drupal_get_path('module', 'block') . '/css/block.admin.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.ajax'),
),
);
return $libraries;
}
......@@ -145,7 +145,7 @@ public function buildForm(array $form, array &$form_state) {
}
$entities = $this->load();
$form['#theme'] = array('block_list');
$form['#attached']['library'][] = array('system', 'drupal.tableheader');
$form['#attached']['library'][] = array('core', 'drupal.tableheader');
$form['#attached']['library'][] = array('block', 'drupal.block');
$form['#attached']['library'][] = array('block', 'drupal.block.admin');
$form['#attributes']['class'][] = 'clearfix';
......
drupal.book:
version: VERSION
js:
book.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.form
......@@ -826,23 +826,3 @@ function book_node_type_update(NodeTypeInterface $type) {
function book_link_load($mlid) {
return entity_load('menu_link', $mlid);
}
/**
* Implements hook_library_info().
*/
function book_library_info() {
$libraries['drupal.book'] = array(
'title' => 'Book',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'book') . '/book.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.form'),
),
);
return $libraries;
}
drupal.ckeditor:
version: VERSION
js:
js/ckeditor.js: {}
css:
state:
css/ckeditor.css: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.debounce
- core/ckeditor
- editor/drupal.editor
drupal.ckeditor.admin:
version: VERSION
js:
js/ckeditor.admin.js: {}
css:
theme:
css/ckeditor.admin.css: {}
/core/assets/vendor/ckeditor/skins/moono/editor.css: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings
- core/jquery.once
- core/jquery.ui.sortable
- core/jquery.ui.draggable
- core/jquery.ui.touch-punch
- core/backbone
- core/drupal.dialog
- core/drupal.announce
- core/ckeditor
- editor/drupal.editor.admin
# Ensure to run after core/drupal.vertical-tabs.
- core/drupal.vertical-tabs
drupal.ckeditor.drupalimage.admin:
version: VERSION
js:
js/ckeditor.drupalimage.admin.js: {}
dependencies:
- core/jquery
- core/drupal
- core/jquery.once
- core/drupal.vertical-tabs
- core/drupalSettings
drupal.ckeditor.stylescombo.admin:
version: VERSION
js:
js/ckeditor.stylescombo.admin.js: {}
dependencies:
- core/jquery
- core/drupal
- core/jquery.once
- core/drupal.vertical-tabs
- core/drupalSettings
drupal.ckeditor.drupalimagecaption-theme:
version: VERSION
js:
js/plugins/drupalimagecaption/theme.js: {}
dependencies:
- core/ckeditor
......@@ -31,108 +31,6 @@ function ckeditor_help($path, $arg) {
}
}
/**
* Implements hook_library_info().
*/
function ckeditor_library_info() {
$module_path = drupal_get_path('module', 'ckeditor');
$libraries['drupal.ckeditor'] = array(
'title' => 'Drupal behavior to enable CKEditor on textareas.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.js' => array(),
),
'css' => array(
$module_path . '/css/ckeditor.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.debounce'),
array('ckeditor', 'ckeditor'),
array('editor', 'drupal.editor'),
),
);
$libraries['drupal.ckeditor.admin'] = array(
'title' => 'Drupal behavior for drag-and-drop CKEditor toolbar builder UI.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.admin.js' => array(),
),
'css' => array(
$module_path . '/css/ckeditor.admin.css' => array(),
'core/assets/vendor/ckeditor/skins/moono/editor.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupalSettings'),
array('system', 'jquery.once'),
array('system', 'jquery.ui.sortable'),
array('system', 'jquery.ui.draggable'),
array('system', 'jquery.ui.touch-punch'),
array('system', 'backbone'),
array('system', 'drupal.dialog'),
array('system', 'drupal.announce'),
array('ckeditor', 'ckeditor'),
array('editor', 'drupal.editor.admin'),
// Depend on Vertical Tabs, so that Vertical Tabs' JavaScript is executed
// first, which ensures its behavior runs first.
array('system', 'drupal.vertical-tabs'),
),
);
$libraries['drupal.ckeditor.drupalimage.admin'] = array(
'title' => 'Only show the "drupalimage" plugin settings when its button is enabled.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.drupalimage.admin.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'drupal.vertical-tabs'),
array('system', 'drupalSettings'),
),
);
$libraries['drupal.ckeditor.stylescombo.admin'] = array(
'title' => 'Only show the "stylescombo" plugin settings when its button is enabled.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.stylescombo.admin.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'drupal.vertical-tabs'),
array('system', 'drupalSettings'),
),
);
$libraries['drupal.ckeditor.drupalimagecaption-theme'] = array(
'title' => 'Theming support for the imagecaption plugin.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/plugins/drupalimagecaption/theme.js' => array(),
),
'dependencies' => array(
array('ckeditor', 'ckeditor'),
),
);
$libraries['ckeditor'] = array(
'title' => 'Loads the main CKEditor library.',
'version' => '4.3-dev — d8-imagecaption branch commit 887d81ac1824008b690e439a1b29eb4f13b51212',
'js' => array(
'core/assets/vendor/ckeditor/ckeditor.js' => array(
'preprocess' => FALSE,
),
),
);
return $libraries;
}
/**
* Implements hook_theme().
*/
......
......@@ -34,7 +34,7 @@ public function getFile() {
*/
public function getLibraries(Editor $editor) {
return array(
array('system', 'drupal.ajax'),
array('core', 'drupal.ajax'),
);
}
......
......@@ -33,7 +33,7 @@ public function getFile() {
*/
public function getLibraries(Editor $editor) {
return array(
array('system', 'drupal.ajax'),
array('core', 'drupal.ajax'),
);
}
......
drupal.color:
version: VERSION
js:
color.js: {}
dependencies:
- core/jquery
- core/drupal
- core/jquery.once
- core/jquery.farbtastic
- color/drupal.color.preview
drupal.color.preview:
version: VERSION
js:
preview.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings
- core/jquery.once
......@@ -774,38 +774,3 @@ function _color_rgb2hsl($rgb) {
return array($h, $s, $l);
}
/**
* Implements hook_library_info().
*/
function color_library_info() {
$libraries['drupal.color'] = array(
'title' => 'Color',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/color.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'jquery.farbtastic'),
array('color', 'drupal.color.preview'),
),
);
$libraries['drupal.color.preview'] = array(
'title' => 'Color preview',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/preview.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupalSettings'),
array('system', 'jquery.once'),
),
);
return $libraries;
}
drupal.comment:
version: VERSION
js:
comment-entity-form.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.form
drupal.comment-by-viewer:
version: VERSION
js:
js/comment-by-viewer.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings
drupal.comment-new-indicator:
version: VERSION
js:
js/comment-new-indicator.js: {}
dependencies:
- core/jquery
- core/drupal
- history/drupal.history
- core/drupal.displace
drupal.node-new-comments-link:
version: VERSION
js:
js/node-new-comments-link.js: {}
dependencies:
- core/jquery
- core/drupal
- history/drupal.history
......@@ -1583,60 +1583,3 @@ function comment_file_download_access($field, EntityInterface $entity, FileInter
return FALSE;
}
}
/**
* Implements hook_library_info().
*/
function comment_library_info() {
$path = drupal_get_path('module', 'comment');
$libraries['drupal.comment'] = array(
'title' => 'Comment',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/comment-entity-form.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.form'),
),
);
$libraries['drupal.comment-by-viewer'] = array(
'title' => 'Annotate comments by the current viewer for targeted styling',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/js/comment-by-viewer.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupalSettings'),
),
);
$libraries['drupal.comment-new-indicator'] = array(
'title' => 'New comment indicator',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/js/comment-new-indicator.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('history', 'drupal.history'),
array('system', 'drupal.displace'),
),
);
$libraries['drupal.node-new-comments-link'] = array(
'title' => 'New comments link',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/js/node-new-comments-link.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('history', 'drupal.history'),
),
);
return $libraries;
}
......@@ -98,7 +98,7 @@ public function form(array $form, array &$form_state) {
$is_admin = $comment->id() && $this->currentUser->hasPermission('administer comments');
if (!$this->currentUser->isAuthenticated() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
$form['#attached']['library'][] = array('system', 'jquery.cookie');