diff --git a/core/core.library.yml b/core/core.library.yml new file mode 100644 index 0000000..c834afa --- /dev/null +++ b/core/core.library.yml @@ -0,0 +1,638 @@ +backbone: + remote: https://github.com/jashkenas/backbone/ + version: 0.9.2 + js: + - { file: assets/vendor/backbone/backbone.js, group: -100, weight: -19 } + dependencies: + - core/underscore + +ckeditor: + remote: https://github.com/ckeditor/ckeditor-dev + # @todo Stable release required for Drupal 8.0. + version: 4.2-dev + commit: 887d81ac1824008b690e439a1b29eb4f13b51212 + js: + - { file: assets/vendor/ckeditor/ckeditor.js, preprocess: false } + +domready: + remote: https://github.com/ded/domready + # @todo Stable release required for Drupal 8.0. + version: master + js: + - { file: assets/vendor/domready/ready.min.js, group: -100, weight: -21 } + +drupal: + version: VERSION + js: + - { file: misc/drupal.js, group: -100, weight: -18 } + dependencies: + - core/domready + +drupalSettings: + version: VERSION + js: + - { settings: { } } + +drupal.ajax: + version: VERSION + js: + - { file: misc/ajax.js, group: -100, weight: 2 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.progress + - core/jquery.once + +drupal.announce: + version: VERSION + js: + - { file: misc/announce.js, group: -100 } + dependencies: + - core/drupal + - core/drupal.debounce + +drupal.autocomplete: + version: VERSION + js: + - { file: misc/autocomplete.js, group: -100, weight: -1 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.ajax + - core/jquery.ui.autocomplete + +drupal.batch: + version: VERSION + js: + - { file: misc/batch.js, group: 0, cache: false } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.ajax + - core/drupal.progress + - core/jquery.once + +drupal.collapse: + version: VERSION + js: + - { file: misc/collapse.js, group: 0 } + dependencies: + - core/jquery + - core/modernizr + - core/drupal + - core/drupal.form + - core/jquery.once + +drupal.debounce: + version: VERSION + js: + - { file: misc/debounce.js, group: -100 } + dependencies: + - core/drupal + +drupal.dialog: + version: VERSION + js: + - { file: misc/dialog.js, group: -100 } + - { file: misc/dialog.position.js, group: -100 } + css: + - { file: misc/dialog.theme.css, weight: 1 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.debounce + - core/drupal.displace + - core/jquery.ui.dialog + +drupal.dialog.ajax: + version: VERSION + js: + - { file: misc/dialog.ajax.js, group: -100, weight: 3 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.ajax + - core/drupal.dialog + +drupal.displace: + version: VERSION + js: + - { file: misc/displace.js, group: -100 } + dependencies: + - core/jquery + - core/drupal + - core/drupal.debounce + +drupal.dropbutton: + version: VERSION + js: + - { file: misc/dropbutton/dropbutton.js } + css: + - { file: misc/dropbutton/dropbutton.css } + - { file: misc/dropbutton/dropbutton.theme.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + +drupal.form: + version: VERSION + js: + - { file: misc/form.js, group: -100, weight: 1 } + dependencies: + - core/jquery + - core/drupal + - core/jquery.cookie + - core/jquery.once + +drupal.machine-name: + version: VERSION + js: + - { file: misc/machine-name.js } + dependencies: + - core/jquery + - core/jquery.once + - core/drupal + - core/drupalSettings + +drupal.progress: + version: VERSION + js: + - { file: misc/progress.js, group: 0 } + dependencies: + - core/drupal + - core/jquery + - core/drupalSettings + +drupal.states: + version: VERSION + js: + - { file: misc/states.js, group: -100, weight: 1 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + +drupal.tabbingmanager: + version: VERSION + js: + - { file: misc/tabbingmanager.js, group: -100 } + dependencies: + - core/jquery + - core/jquery.ui + - core/drupal + +drupal.tabledrag: + version: VERSION + js: + - { file: misc/tabledrag.js, group: -100, weight: -1 } + dependencies: + - core/jquery + - core/modernizr + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/jquery.cookie + +drupal.tableheader: + version: VERSION + js: + - { file: misc/tableheader.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/drupal.displace + +drupal.tableresponsive: + version: VERSION + js: + - { file: misc/tableresponsive.js, group: -100 } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + +drupal.tableselect: + version: VERSION + js: + - { file: misc/tableselect.js } + dependencies: + - core/drupal + - core/jquery + +drupal.timezone: + version: VERSION + js: + - { file: misc/timezone.js } + dependencies: + - core/jquery + - core/drupal + +drupal.vertical-tabs: + version: VERSION + js: + - { file: misc/vertical-tabs.js } + css: + - { file: misc/vertical-tabs.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.form + +html5shiv: + remote: https://github.com/aFarkas/html5shiv + version: 3.6.2 + js: + - { file: assets/vendor/html5shiv/html5.js, group: -100, weight: -22, browsers: { IE: 'lte IE 8', '!IE': false } } + +jquery: + remote: https://github.com/jquery/jquery + version: 2.0.3 + js: + - { file: assets/vendor/jquery/jquery.js, group: -100, weight: -20 } + +jquery.bbq: + remote: https://github.com/cowboy/jquery-bbq + # @todo Ping @benalman to create stable release. + version: v1.3pre + js: + - { file: assets/vendor/jquery-bbq/jquery.ba-bbq.js } + dependencies: + - core/jquery + +jquery.cookie: + # @todo jquery.cookie.js no longer exists in the latest jQuery UI. + # @see https://github.com/jquery/jquery-ui/tree/master/external + # @see https://github.com/carhartl/jquery-cookie + version: 1.10.2 + js: + - { file: assets/vendor/jquery.ui/external/jquery.cookie.js } + dependencies: + - core/jquery + +jquery.farbtastic: + remote: https://github.com/mattfarina/farbtastic + # @todo Ping @robloach or @mattfarina to retroactively create this release. + version: 1.2 + js: + - { file: assets/vendor/farbtastic/farbtastic.js } + css: + - { file: assets/vendor/farbtastic/farbtastic.css } + dependencies: + - core/jquery + +jquery.form: + remote: https://github.com/malsup/form + version: 3.39 + js: + - { file: assets/vendor/jquery-form/jquery.form.js } + dependencies: + - core/jquery + - core/jquery.cookie + +jquery.once: + remote: https://github.com/RobLoach/jquery-once + version: 1.2.3 + js: + - { file: assets/vendor/jquery-once/jquery.once.js, group: -100, weight: -19 } + dependencies: + - core/jquery + +jquery.ui: + remote: https://github.com/jquery/jquery-ui + version: &jquery.ui 1.10.2 + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.core.js, group: -100, weight: -11 } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.core.css } + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.theme.css } + dependencies: + - core/jquery + +jquery.ui.accordion: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.accordion.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.accordion.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + +jquery.ui.autocomplete: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.autocomplete.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.autocomplete.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + - core/jquery.ui.position + - core/jquery.ui.menu + +jquery.ui.button: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.button.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.button.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + +jquery.ui.datepicker: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.datepicker.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.datepicker.css } + dependencies: + - core/jquery.ui + +jquery.ui.dialog: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.dialog.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.dialog.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + - core/jquery.ui.button + - core/jquery.ui.draggable + - core/jquery.ui.mouse + - core/jquery.ui.position + - core/jquery.ui.resizable + +jquery.ui.draggable: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.draggable.js } + dependencies: + - core/jquery.ui + - core/jquery.ui.mouse + - core/jquery.ui.widget + +jquery.ui.droppable: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.droppable.js } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + - core/jquery.ui.mouse + - core/jquery.ui.draggable + +jquery.ui.effects.core: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.core.js, group: -100, weight: -9 } + +jquery.ui.effects.blind: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.blind.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.bounce: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.bounce.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.clip: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.clip.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.drop: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.drop.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.explode: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.explode.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.fade: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.fade.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.fold: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.fold.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.highlight: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.highlight.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.pulsate: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.pulsate.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.scale: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.scale.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.shake: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.shake.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.slide: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.slide.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.transfer: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.effects.transfer.js } + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.menu: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.menu.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.menu.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + +jquery.ui.mouse: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.mouse.js } + dependencies: + - core/jquery.ui.widget + +jquery.ui.position: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.position.js } + +jquery.ui.progressbar: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.progressbar.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.progressbar.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + +jquery.ui.resizable: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.resizable.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.resizable.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + - core/jquery.ui.mouse + +jquery.ui.selectable: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.selectable.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.selectable.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.mouse + - core/jquery.ui.widget + +jquery.ui.slider: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.slider.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.slider.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.mouse + - core/jquery.ui.widget + +jquery.ui.sortable: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.sortable.js } + dependencies: + - core/jquery.ui + - core/jquery.ui.mouse + - core/jquery.ui.widget + +jquery.ui.spinner: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.spinner.js } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + - core/jquery.ui.button + +jquery.ui.tabs: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.tabs.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.tabs.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + +jquery.ui.tooltip: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.tooltip.js } + css: + - { file: assets/vendor/jquery.ui/themes/base/jquery.ui.tooltip.css } + dependencies: + - core/jquery.ui + - core/jquery.ui.widget + - core/jquery.ui.position + +jquery.ui.touch-punch: + remote: https://github.com/furf/jquery-ui-touch-punch + version: 0.2.2 + js: + - { file: assets/vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js } + dependencies: + - core/jquery.ui + +jquery.ui.widget: + version: *jquery.ui + js: + - { file: assets/vendor/jquery.ui/ui/jquery.ui.widget.js, group: -100, weight: -10 } + dependencies: + - core/jquery.ui + +matchmedia: + remote: https://github.com/paulirish/matchMedia.js + # @todo Contribute upstream and replace with upstream version. + version: VERSION + js: + - { file: misc/matchmedia.js } + dependencies: + - core/drupal.debounce + +modernizr: + remote: https://github.com/Modernizr/Modernizr + version: v2.6.2 + js: + - { file: assets/vendor/modernizr/modernizr.min.js, every_page: true, group: -100, preprocess: 0, scope: header, weight: -21 } + +normalize: + remote: https://github.com/necolas/normalize.css + version: v2.1.2 + css: + - { file: assets/vendor/normalize-css/normalize.css, every_page: true, weight: -220 } + +underscore: + remote: https://github.com/jashkenas/underscore + version: 1.4.0 + js: + - { file: assets/vendor/underscore/underscore.js, group: -100, weight: -20 } + diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index 5c4bb99..46a8742 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -475,8 +475,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']; diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 049b3fb..c72fa91 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -171,7 +171,7 @@ function _batch_progress_page() { ), ); drupal_add_js($js_setting, 'setting'); - drupal_add_library('system', 'drupal.batch'); + drupal_add_library('core', 'drupal.batch'); return theme('progress_bar', array('percent' => $percentage, 'message' => $message, 'label' => $label)); } diff --git a/core/includes/common.inc b/core/includes/common.inc index a584b4d..a9c194d 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -12,6 +12,7 @@ use Drupal\Core\Language\Language; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Yaml\Parser; use Drupal\Component\PhpStorage\PhpStorageFactory; use Drupal\Component\Utility\MapArray; use Drupal\Component\Utility\NestedArray; @@ -2657,7 +2658,7 @@ function drupal_process_attached($elements, $dependency_check = FALSE) { * @see form_example_states_form() */ function drupal_process_states(&$elements) { - $elements['#attached']['library'][] = array('system', 'drupal.states'); + $elements['#attached']['library'][] = array('core', 'drupal.states'); // Elements of '#type' => 'item' are not actual form input elements, but we // still want to be able to show/hide them. Since there's no actual HTML input // element available, setting #attributes does not make sense, but a wrapper @@ -2688,7 +2689,6 @@ function drupal_process_states(&$elements) { * its dependencies could not be added. * * @see drupal_get_library() - * @see hook_library_info() * @see hook_library_info_alter() */ function drupal_add_library($module, $name, $every_page = NULL) { @@ -2705,10 +2705,6 @@ function drupal_add_library($module, $name, $every_page = NULL) { ); foreach (array('js', 'css') as $type) { foreach ($elements['#attached'][$type] as $data => $options) { - // Apply the JS_LIBRARY group if it isn't explicitly given. - if ($type == 'js' && !isset($options['group'])) { - $elements['#attached']['js'][$data]['group'] = JS_LIBRARY; - } // Set the every_page flag if one was passed. if (isset($every_page)) { $elements['#attached'][$type][$data]['every_page'] = $every_page; @@ -2752,41 +2748,98 @@ function drupal_add_library($module, $name, $every_page = NULL) { * of libraries registered by $module is returned (which may be empty). * * @see drupal_add_library() - * @see hook_library_info() * @see hook_library_info_alter() * * @todo The purpose of drupal_get_*() is completely different to other page * requisite API functions; find and use a different name. */ function drupal_get_library($module, $name = NULL) { + static $library_info = array(); $libraries = &drupal_static(__FUNCTION__, array()); + if ($module === 'core') { + $module_path = 'core'; + $library_file = 'core/core.library.yml'; + } + else { + // @todo Add a $type argument OR automatically figure out the type based on + // current extension data, possibly using a module->theme fallback mechanism. + $module_path = drupal_get_path('module', $module); + if (in_array($module, array('seven', 'bartik'))) { + $module_path = drupal_get_path('theme', $module); + } + $library_file = $module_path . '/' . $module . '.library.yml'; + } + if (!isset($libraries[$module])) { - // Retrieve all libraries associated with the module. - $module_libraries = module_invoke($module, 'library_info'); - if (empty($module_libraries)) { - $module_libraries = array(); + if (!isset($library_info[$module])) { + $library_info[$module] = array(); + if (file_exists($library_file)) { + $parser = new Parser(); + $library_info[$module] = $parser->parse(file_get_contents($library_file)) ?: array(); + } } + $module_libraries = $library_info[$module]; + // Allow modules to alter the module's registered libraries. drupal_alter('library_info', $module_libraries, $module); - foreach ($module_libraries as $key => $data) { - if (is_array($data)) { - // Add default elements to allow for easier processing. - $module_libraries[$key] += array('dependencies' => array(), 'js' => array(), 'css' => array()); - foreach ($module_libraries[$key]['js'] as $file => $options) { - if (is_scalar($options)) { - // The JavaScript or CSS file has been specified in shorthand - // format, without an array of options. In this case $options is the - // filename. Convert the shorthand version and remove the old array - // key. - unset($module_libraries[$key]['js'][$file]); - $file = $options; - $options = array(); + foreach ($module_libraries as $id => $library) { + $library += array('dependencies' => array(), 'js' => array(), 'css' => array()); + + if (isset($library['version'])) { + // @todo Retrieve version of a non-core extension. + if ($library['version'] === 'VERSION') { + $library['version'] = \Drupal::VERSION; + } + // Remove 'v' prefix from external library versions. + elseif ($library['version'][0] === 'v') { + $library['version'] = substr($library['version'], 1); + } + } + + foreach (array('js', 'css') as $type) { + foreach ($library[$type] as $i => $options) { + // Apply the JS_LIBRARY group if it wasn't explicitly set. + if (!isset($options['group']) && $type == 'js') { + $options['group'] = JS_LIBRARY; + } + + if (isset($options['file'])) { + $options['type'] = 'file'; + // An absolute path maps to DRUPAL_ROOT. + if ($options['file'][0] === '/' && $options['file'][1] !== '/') { + $options['data'] = substr($options['file'], 1); + } + else { + $options['data'] = $module_path . '/' . $options['file']; + } + unset($options['file']); + $options['version'] = $library['version']; } - $module_libraries[$key]['js'][$file]['version'] = $module_libraries[$key]['version']; + elseif (isset($options['external'])) { + $options['type'] = 'external'; + $options['data'] = $options['external']; + unset($options['external']); + $options['version'] = $library['version']; + } + elseif (isset($options['settings'])) { + $options['type'] = 'setting'; + $options['data'] = $options['settings']; + unset($options['settings']); + } + + unset($library[$type][$i]); + $library[$type][] = $options; + } + } + // @todo Replace all uses of #attached and remove this. + foreach ($library['dependencies'] as $i => $dependency) { + if (!is_array($dependency)) { + $library['dependencies'][$i] = explode('/', $dependency, 2); } } + $module_libraries[$id] = $library; } $libraries[$module] = $module_libraries; } @@ -2940,7 +2993,7 @@ function drupal_attach_tabledrag(&$element, array $options) { 'limit' => $options['limit'], ); - $element['#attached']['library'][] = array('system', 'drupal.tabledrag'); + $element['#attached']['library'][] = array('core', 'drupal.tabledrag'); $element['#attached']['js'][] = array('data' => $settings, 'type' => 'setting'); } @@ -3576,7 +3629,7 @@ function drupal_pre_render_links($element) { * Pre-render callback: Attaches the dropbutton library and required markup. */ function drupal_pre_render_dropbutton($element) { - $element['#attached']['library'][] = array('system', 'drupal.dropbutton'); + $element['#attached']['library'][] = array('core', 'drupal.dropbutton'); $element['#attributes']['class'][] = 'dropbutton'; if (!isset($element['#theme_wrappers'])) { $element['#theme_wrappers'] = array(); diff --git a/core/includes/form.inc b/core/includes/form.inc index 87f8edf..8b87e1b 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -1566,7 +1566,7 @@ function theme_tableselect($variables) { // checkboxes/radios in the first table column. if ($element['#js_select']) { // Add a "Select all" checkbox. - drupal_add_library('system', 'drupal.tableselect'); + drupal_add_library('core', 'drupal.tableselect'); array_unshift($header, array('class' => array('select-all'))); } else { @@ -1681,7 +1681,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" @@ -1881,7 +1881,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; @@ -1954,7 +1954,7 @@ function form_process_group(&$element, &$form_state) { } // Contains form element summary functionalities. - $element['#attached']['library'][] = array('system', 'drupal.form'); + $element['#attached']['library'][] = array('core', 'drupal.form'); return $element; } @@ -1977,7 +1977,7 @@ function form_pre_render_details($element) { } // Collapsible details. - $element['#attached']['library'][] = array('system', 'drupal.collapse'); + $element['#attached']['library'][] = array('core', 'drupal.collapse'); if (empty($element['#collapsed'])) { $element['#attributes']['open'] = 'open'; } @@ -2069,7 +2069,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 @@ -2158,7 +2158,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; } diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 8762f0b..cde1b69 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -2105,7 +2105,7 @@ function install_configure_form($form, &$form_state, &$install_state) { drupal_add_library('system', 'drupal.system'); // Add JavaScript time zone detection. - drupal_add_library('system', 'drupal.timezone'); + drupal_add_library('core', 'drupal.timezone'); // We add these strings as settings because JavaScript translation does not // work during installation. drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail'))), 'setting'); diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 9545be7..7c71035 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1553,7 +1553,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'; @@ -1562,7 +1562,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'; @@ -2147,7 +2147,7 @@ function template_preprocess_html(&$variables) { drupal_add_html_head($element, $name); } - drupal_add_library('system', 'html5shiv', TRUE); + drupal_add_library('core', 'html5shiv', TRUE); // Render page_top and page_bottom into top level variables. $variables['page_top'] = array(); @@ -2427,7 +2427,7 @@ 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'); + $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( diff --git a/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php index 45115df..3742843 100644 --- a/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php +++ b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php @@ -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']; diff --git a/core/modules/block/block.library.yml b/core/modules/block/block.library.yml new file mode 100644 index 0000000..98ac0d9 --- /dev/null +++ b/core/modules/block/block.library.yml @@ -0,0 +1,16 @@ +drupal.block: + version: VERSION + js: + - { file: block.js } + dependencies: + - core/jquery + - core/drupal +drupal.block.admin: + version: VERSION + js: + - { file: js/block.admin.js } + css: + - { file: css/block.admin.css } + dependencies: + - core/jquery + - core/drupal diff --git a/core/modules/block/block.module b/core/modules/block/block.module index dd3aa6f..b191748 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -561,36 +561,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'), - ), - ); - - return $libraries; -} diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php index 6db9219..3439f53 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -149,7 +149,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'; diff --git a/core/modules/book/book.library.yml b/core/modules/book/book.library.yml new file mode 100644 index 0000000..20365b7 --- /dev/null +++ b/core/modules/book/book.library.yml @@ -0,0 +1,8 @@ +drupal.book: + version: VERSION + js: + - { file: book.js } + dependencies: + - core/jquery + - core/drupal + - core/drupal.form diff --git a/core/modules/book/book.module b/core/modules/book/book.module index ec8cf4c..177e6b2 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -801,23 +801,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; -} diff --git a/core/modules/ckeditor/ckeditor.library.yml b/core/modules/ckeditor/ckeditor.library.yml new file mode 100644 index 0000000..e747149 --- /dev/null +++ b/core/modules/ckeditor/ckeditor.library.yml @@ -0,0 +1,60 @@ +drupal.ckeditor: + version: VERSION + js: + - { file: js/ckeditor.js } + - { settings: { ckeditor: { modulePath: core/modules/ckeditor } } } + css: + - { file: css/ckeditor.css } + dependencies: + - core/jquery + - core/drupal + - core/drupal.debounce + - core/ckeditor + - editor/drupal.editor +drupal.ckeditor.admin: + version: VERSION + js: + - { file: js/ckeditor.admin.js } + css: + - { file: css/ckeditor.admin.css } + - { file: /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 + - core/drupal.vertical-tabs +drupal.ckeditor.drupalimage.admin: + version: VERSION + js: + - { file: 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: + - { file: 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: + - { file: js/plugins/drupalimagecaption/theme.js } + dependencies: + - core/ckeditor diff --git a/core/modules/ckeditor/ckeditor.module b/core/modules/ckeditor/ckeditor.module index a33ecf2..10d5376 100644 --- a/core/modules/ckeditor/ckeditor.module +++ b/core/modules/ckeditor/ckeditor.module @@ -32,114 +32,6 @@ function ckeditor_help($path, $arg) { } /** - * Implements hook_library_info(). - */ -function ckeditor_library_info() { - $module_path = drupal_get_path('module', 'ckeditor'); - - $settings = array( - 'ckeditor' => array( - 'modulePath' => 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(), - array('data' => $settings, 'type' => 'setting'), - ), - '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(). */ function ckeditor_theme() { diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php index 9fc56a2..8e5f0ab 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php @@ -34,7 +34,7 @@ public function getFile() { */ public function getLibraries(Editor $editor) { return array( - array('system', 'drupal.ajax'), + array('core', 'drupal.ajax'), ); } diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php index 2e764c1..91a513a 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php @@ -33,7 +33,7 @@ public function getFile() { */ public function getLibraries(Editor $editor) { return array( - array('system', 'drupal.ajax'), + array('core', 'drupal.ajax'), ); } diff --git a/core/modules/color/color.library.yml b/core/modules/color/color.library.yml new file mode 100644 index 0000000..22b02c6 --- /dev/null +++ b/core/modules/color/color.library.yml @@ -0,0 +1,19 @@ +drupal.color: + version: VERSION + js: + - { file: color.js } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + - core/jquery.farbtastic + - color/drupal.color.preview +drupal.color.preview: + version: VERSION + js: + - { file: preview.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once diff --git a/core/modules/color/color.module b/core/modules/color/color.module index aaf0ba6..72491d6 100644 --- a/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -773,38 +773,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; -} diff --git a/core/modules/comment/comment.library.yml b/core/modules/comment/comment.library.yml new file mode 100644 index 0000000..5629b4b --- /dev/null +++ b/core/modules/comment/comment.library.yml @@ -0,0 +1,33 @@ +drupal.comment: + version: VERSION + js: + - { file: comment-entity-form.js } + dependencies: + - core/jquery + - core/drupal + - core/drupal.form +drupal.comment-by-viewer: + version: VERSION + js: + - { file: js/comment-by-viewer.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings +drupal.comment-new-indicator: + version: VERSION + js: + - { file: js/comment-new-indicator.js } + dependencies: + - core/jquery + - core/drupal + - history/drupal.history + - core/drupal.displace +drupal.node-new-comments-link: + version: VERSION + js: + - { file: js/node-new-comments-link.js } + dependencies: + - core/jquery + - core/drupal + - history/drupal.history diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 1491817..970f62f 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1656,60 +1656,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; -} diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index 8a5d52f..379ba38 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -90,7 +90,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'); + $form['#attached']['library'][] = array('core', 'jquery.cookie'); $form['#attributes']['class'][] = 'user-info-from-cookie'; } diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php index 4287d86..641abe0 100644 --- a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php @@ -166,7 +166,7 @@ public function buildForm(array $form, array &$form_state) { } // Add the AJAX library to the form for dialog support. - $form['#attached']['library'][] = array('system', 'drupal.ajax'); + $form['#attached']['library'][] = array('core', 'drupal.ajax'); foreach ($config_comparer->getChangelist() as $config_change_type => $config_files) { if (empty($config_files)) { diff --git a/core/modules/config_translation/config_translation.library.yml b/core/modules/config_translation/config_translation.library.yml new file mode 100644 index 0000000..aefcbda --- /dev/null +++ b/core/modules/config_translation/config_translation.library.yml @@ -0,0 +1,4 @@ +drupal.config_translation.admin: + version: VERSION + css: + - { file: css/config_translation.admin.css } diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index 0fc1170..8718423 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -163,20 +163,6 @@ function config_translation_config_translation_type_info_alter(&$definitions) { } /** - * Implements hook_library_info(). - */ -function config_translation_library_info() { - $libraries['drupal.config_translation.admin'] = array( - 'title' => 'Configuration translation admin', - 'version' => \Drupal::VERSION, - 'css' => array( - drupal_get_path('module', 'config_translation') . '/css/config_translation.admin.css' => array(), - ), - ); - return $libraries; -} - -/** * Implements hook_local_tasks_alter(). */ function config_translation_local_tasks_alter(&$local_tasks) { diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php index ca4a607..8e8e46a 100644 --- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php +++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php @@ -45,7 +45,7 @@ public function form(array $form, array &$form_state) { '#required' => TRUE, ); if ($user->isAnonymous()) { - $form['#attached']['library'][] = array('system', 'jquery.cookie'); + $form['#attached']['library'][] = array('core', 'jquery.cookie'); $form['#attributes']['class'][] = 'user-info-from-cookie'; } // Do not allow authenticated users to alter the name or e-mail values to diff --git a/core/modules/content_translation/content_translation.library.yml b/core/modules/content_translation/content_translation.library.yml new file mode 100644 index 0000000..deae9a5 --- /dev/null +++ b/core/modules/content_translation/content_translation.library.yml @@ -0,0 +1,10 @@ +drupal.content_translation.admin: + version: VERSION + js: + - { file: content_translation.admin.js } + css: + - { file: css/content_translation.admin.css } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 0d476cb..21ffa2a 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -386,30 +386,6 @@ function content_translation_delete_access(EntityInterface $entity, Language $la } /** - * Implements hook_library_info(). - */ -function content_translation_library_info() { - $path = drupal_get_path('module', 'content_translation'); - $libraries['drupal.content_translation.admin'] = array( - 'title' => 'Content translation UI', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/content_translation.admin.js' => array(), - ), - 'css' => array( - $path . '/css/content_translation.admin.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - - return $libraries; -} - -/** * Returns the key name used to store the configuration setting. * * Based on the entity type and bundle, the keys used to store configuration diff --git a/core/modules/contextual/contextual.library.yml b/core/modules/contextual/contextual.library.yml new file mode 100644 index 0000000..3bf6e15 --- /dev/null +++ b/core/modules/contextual/contextual.library.yml @@ -0,0 +1,28 @@ +drupal.contextual-links: + version: VERSION + js: + - { file: js/contextual.js, group: -100, weight: -2 } + css: + - { file: css/contextual.module.css } + - { file: css/contextual.theme.css } + - { file: css/contextual.icons.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/backbone + - core/modernizr + - core/jquery.once +drupal.contextual-toolbar: + version: VERSION + js: + - { file: js/contextual.toolbar.js, group: -100 } + css: + - { file: css/contextual.toolbar.css } + dependencies: + - core/jquery + - core/drupal + - core/backbone + - core/jquery.once + - core/drupal.tabbingmanager + - core/drupal.announce diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module index a465e47..9a61095 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module @@ -90,56 +90,6 @@ function contextual_permission() { } /** - * Implements hook_library_info(). - */ -function contextual_library_info() { - $path = drupal_get_path('module', 'contextual'); - $libraries['drupal.contextual-links'] = array( - 'title' => 'Contextual Links', - 'website' => 'http://drupal.org/node/473268', - 'version' => \Drupal::VERSION, - 'js' => array( - // Add the JavaScript, with a group and weight such that it will run - // before modules/contextual/js/contextual.toolbar.js. - $path . '/js/contextual.js' => array('group' => JS_LIBRARY, 'weight' => -2), - ), - 'css' => array( - $path . '/css/contextual.module.css' => array(), - $path . '/css/contextual.theme.css' => array(), - $path . '/css/contextual.icons.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'backbone'), - array('system', 'modernizr'), - array('system', 'jquery.once'), - ), - ); - $libraries['drupal.contextual-toolbar'] = array( - 'title' => 'Contextual Links Toolbar Tab', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/contextual.toolbar.js' => array('group' => JS_LIBRARY), - ), - 'css' => array( - $path . '/css/contextual.toolbar.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'backbone'), - array('system', 'jquery.once'), - array('system', 'drupal.tabbingmanager'), - array('system', 'drupal.announce'), - ), - ); - - return $libraries; -} - -/** * Implements hook_element_info(). */ function contextual_element_info() { diff --git a/core/modules/edit/edit.library.yml b/core/modules/edit/edit.library.yml new file mode 100644 index 0000000..98a9f4c --- /dev/null +++ b/core/modules/edit/edit.library.yml @@ -0,0 +1,46 @@ +edit: + version: VERSION + js: + - { file: js/edit.js, scope: footer } + - { file: js/util.js, scope: footer } + - { file: js/models/AppModel.js, scope: footer } + - { file: js/models/EntityModel.js, scope: footer } + - { file: js/models/FieldModel.js, scope: footer } + - { file: js/models/EditorModel.js, scope: footer } + - { file: js/views/AppView.js, scope: footer } + - { file: js/views/FieldDecorationView.js, scope: footer } + - { file: js/views/EntityDecorationView.js, scope: footer } + - { file: js/views/EntityToolbarView.js, scope: footer } + - { file: js/views/ContextualLinkView.js, scope: footer } + - { file: js/views/FieldToolbarView.js, scope: footer } + - { file: js/views/EditorView.js, scope: footer } + - { file: js/theme.js, scope: footer } + css: + - { file: css/edit.module.css } + - { file: css/edit.theme.css } + - { file: css/edit.icons.css } + dependencies: + - core/jquery + - core/underscore + - core/backbone + - core/jquery.form + - core/jquery.ui.position + - core/drupal + - core/drupal.displace + - core/drupal.form + - core/drupal.ajax + - core/drupal.debounce + - core/drupalSettings + - core/drupal.dialog +edit.inPlaceEditor.form: + version: VERSION + js: + - { file: js/editors/formEditor.js, scope: footer } + dependencies: + - edit/edit +edit.inPlaceEditor.plainText: + version: VERSION + js: + - { file: js/editors/plainTextEditor.js, scope: footer } + dependencies: + - edit/edit diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module index bc7b314..cb4be31 100644 --- a/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -40,81 +40,6 @@ function edit_page_build(&$page) { } /** - * Implements hook_library_info(). - */ -function edit_library_info() { - $path = drupal_get_path('module', 'edit'); - $options = array( - 'scope' => 'footer', - ); - $libraries['edit'] = array( - 'title' => 'Edit: in-place editing', - 'version' => \Drupal::VERSION, - 'js' => array( - // Core. - $path . '/js/edit.js' => $options, - $path . '/js/util.js' => $options, - // Models. - $path . '/js/models/AppModel.js' => $options, - $path . '/js/models/EntityModel.js' => $options, - $path . '/js/models/FieldModel.js' => $options, - $path . '/js/models/EditorModel.js' => $options, - // Views. - $path . '/js/views/AppView.js' => $options, - $path . '/js/views/FieldDecorationView.js' => $options, - $path . '/js/views/EntityDecorationView.js' => $options, - $path . '/js/views/EntityToolbarView.js' => $options, - $path . '/js/views/ContextualLinkView.js' => $options, - $path . '/js/views/FieldToolbarView.js' => $options, - $path . '/js/views/EditorView.js' => $options, - // Other. - $path . '/js/theme.js' => $options, - ), - 'css' => array( - $path . '/css/edit.module.css' => array(), - $path . '/css/edit.theme.css' => array(), - $path . '/css/edit.icons.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'underscore'), - array('system', 'backbone'), - array('system', 'jquery.form'), - array('system', 'jquery.ui.position'), - array('system', 'drupal'), - array('system', 'drupal.displace'), - array('system', 'drupal.form'), - array('system', 'drupal.ajax'), - array('system', 'drupal.debounce'), - array('system', 'drupalSettings'), - array('system', 'drupal.dialog'), - ), - ); - $libraries['edit.inPlaceEditor.form'] = array( - 'title' => 'Form in-place editor', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/editors/formEditor.js' => $options, - ), - 'dependencies' => array( - array('edit', 'edit'), - ), - ); - $libraries['edit.inPlaceEditor.plainText'] = array( - 'title' => 'Plain text in-place editor', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/editors/plainTextEditor.js' => $options, - ), - 'dependencies' => array( - array('edit', 'edit'), - ), - ); - - return $libraries; -} - -/** * Implement hook_library_info_alter(). * * Allow the admin theme to override the Edit entity toolbar's default styling. @@ -124,8 +49,8 @@ function edit_library_info() { function edit_library_info_alter(&$libraries, $module) { if ($module == 'edit' && isset($libraries['edit'])) { $css = _edit_theme_css(); - foreach ($css as $css_file) { - $libraries['edit']['css'][$css_file] = array(); + foreach ($css as $css_file => $file) { + $libraries['edit']['css'][$css_file] = $file; } } } @@ -207,7 +132,7 @@ function _edit_theme_css($theme = NULL) { if (isset($info['edit_stylesheets'])) { $css = $info['edit_stylesheets']; foreach ($css as $key => $path) { - $css[$key] = $theme_path . '/' . $path; + $css[$key] = array('data' => $theme_path . '/' . $path, 'type' => 'file'); } } if (isset($info['base theme'])) { diff --git a/core/modules/editor/editor.library.yml b/core/modules/editor/editor.library.yml new file mode 100644 index 0000000..aca72d0 --- /dev/null +++ b/core/modules/editor/editor.library.yml @@ -0,0 +1,37 @@ +drupal.editor.admin: + version: VERSION + js: + - { file: js/editor.admin.js } + dependencies: + - core/jquery + - core/drupal +drupal.editor: + version: VERSION + js: + - { file: js/editor.js } + css: + - { file: css/editor.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once +drupal.editor.dialog: + version: VERSION + js: + - { file: js/editor.dialog.js, weight: 2 } + dependencies: + - core/jquery + - core/drupal.dialog + - core/drupal.ajax + - core/drupalSettings +edit.inPlaceEditor.formattedText: + version: VERSION + js: + - { file: js/editor.formattedTextEditor.js, scope: footer, attributes: { defer: true } } + - { settings: { editor: { getUntransformedTextURL: /drupal8/lib.php/editor/%21entity_type/%21id/%21field_name/%21langcode/%21view_mode } } } + dependencies: + - edit/edit + - editor/drupal.editor + - core/drupal.ajax + - core/drupalSettings diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module index affe711..12abc1d 100644 --- a/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -63,82 +63,6 @@ function editor_element_info() { } /** - * Implements hook_library_info(). - */ -function editor_library_info() { - $path = drupal_get_path('module', 'editor'); - - $libraries['drupal.editor.admin'] = array( - 'title' => 'Text Editor', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/editor.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - ), - ); - $libraries['drupal.editor'] = array( - 'title' => 'Text Editor', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/editor.js' => array(), - ), - 'css' => array( - $path . '/css/editor.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - ), - ); - - $libraries['drupal.editor.dialog'] = array( - 'title' => 'Text Editor Dialog', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/editor.dialog.js' => array('weight' => 2), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal.dialog'), - array('system', 'drupal.ajax'), - array('system', 'drupalSettings'), - ), - ); - - $libraries['edit.inPlaceEditor.formattedText'] = array( - 'title' => 'Formatted text in-place editor', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/editor.formattedTextEditor.js' => array( - 'scope' => 'footer', - 'attributes' => array('defer' => TRUE), - ), - array( - 'type' => 'setting', - 'data' => array( - 'editor' => array( - 'getUntransformedTextURL' => url('editor/!entity_type/!id/!field_name/!langcode/!view_mode'), - ) - ) - ), - ), - 'dependencies' => array( - array('edit', 'edit'), - array('editor', 'drupal.editor'), - array('system', 'drupal.ajax'), - array('system', 'drupalSettings'), - ), - ); - - return $libraries; -} - -/** * Implements hook_form_FORM_ID_alter(). */ function editor_form_filter_admin_overview_alter(&$form, $form_state) { diff --git a/core/modules/field_ui/field_ui.library.yml b/core/modules/field_ui/field_ui.library.yml new file mode 100644 index 0000000..b279bdb --- /dev/null +++ b/core/modules/field_ui/field_ui.library.yml @@ -0,0 +1,11 @@ +drupal.field_ui: + version: VERSION + js: + - { file: field_ui.js } + css: + - { file: css/field_ui.admin.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index 2033cf6..f115d7e 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -254,30 +254,6 @@ function field_ui_form_node_type_form_submit($form, &$form_state) { } /** - * Implements hook_library_info(). - */ -function field_ui_library_info() { - $libraries['drupal.field_ui'] = array( - 'title' => 'Field UI', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'field_ui') . '/field_ui.js' => array(), - ), - 'css' => array( - drupal_get_path('module', 'field_ui') . '/css/field_ui.admin.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - ), - ); - - return $libraries; -} - -/** * Implements hook_view_mode_presave(). */ function field_ui_view_mode_presave(EntityViewModeInterface $view_mode) { diff --git a/core/modules/file/file.library.yml b/core/modules/file/file.library.yml new file mode 100644 index 0000000..42fdfc7 --- /dev/null +++ b/core/modules/file/file.library.yml @@ -0,0 +1,10 @@ +drupal.file: + version: VERSION + js: + - { file: file.js } + css: + - { file: css/file.admin.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 4041886..d3828af 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1920,29 +1920,6 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag */ /** - * Implements hook_library_info(). - */ -function file_library_info() { - $libraries['drupal.file'] = array( - 'title' => 'File', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'file') . '/file.js' => array(), - ), - 'css' => array( - drupal_get_path('module', 'file') . '/css/file.admin.css' - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - ), - ); - - return $libraries; -} - -/** * Implements hook_permission(). */ function file_permission() { diff --git a/core/modules/filter/filter.library.yml b/core/modules/filter/filter.library.yml new file mode 100644 index 0000000..6fb4cf4 --- /dev/null +++ b/core/modules/filter/filter.library.yml @@ -0,0 +1,33 @@ +drupal.filter.admin: + version: VERSION + js: + - { file: filter.admin.js } + css: + - { file: css/filter.admin.css } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + - core/drupal.form +drupal.filter.filter_html.admin: + version: VERSION + js: + - { file: filter.filter_html.admin.js } + dependencies: + - core/jquery + - core/jquery.once + - core/underscore +drupal.filter: + version: VERSION + js: + - { file: filter.js } + css: + - { file: css/filter.admin.css } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once +caption: + version: VERSION + css: + - { file: css/filter.caption.css } diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 4962044..e85c269 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -1438,63 +1438,3 @@ function theme_filter_html_image_secure_image(&$variables) { function filter_page_build(&$page) { $page['#attached']['library'][] = array('filter', 'caption'); } - -/** - * Implements hook_library_info(). - */ -function filter_library_info() { - $path = drupal_get_path('module', 'filter'); - - $libraries['drupal.filter.admin'] = array( - 'title' => 'Filter', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/filter.admin.js' => array(), - ), - 'css' => array( - $path . '/css/filter.admin.css' - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - array('system', 'drupal.form'), - ), - ); - $libraries['drupal.filter.filter_html.admin'] = array( - 'title' => 'Automatic "Limit allowed HTML tags" filter setting updating.', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/filter.filter_html.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'jquery.once'), - array('system', 'underscore'), - ), - ); - $libraries['drupal.filter'] = array( - 'title' => 'Filter', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/filter.js' => array(), - ), - 'css' => array( - $path . '/css/filter.admin.css' - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - $libraries['caption'] = array( - 'title' => 'Captions for images and alignments', - 'version' => \Drupal::VERSION, - 'css' => array( - $path . '/css/filter.caption.css', - ), - ); - - return $libraries; -} diff --git a/core/modules/forum/forum.library.yml b/core/modules/forum/forum.library.yml new file mode 100644 index 0000000..45e5ebf --- /dev/null +++ b/core/modules/forum/forum.library.yml @@ -0,0 +1,4 @@ +forum.index: + version: VERSION + css: + - { file: css/forum.module.css } diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 95ebe76..7bde8b1 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -876,20 +876,3 @@ function template_preprocess_forum_submitted(&$variables) { function theme_forum_form(array $variables) { return drupal_render_children($variables['form']); } - -/** - * Implements hook_library_info(). - * - * Forum specific libraries. - */ -function forum_library_info() { - $libraries['forum.index'] = array( - 'title' => 'Forum index', - 'version' => \Drupal::VERSION, - 'css' => array( - drupal_get_path('module', 'forum') . '/css/forum.module.css' => array(), - ), - ); - - return $libraries; -} diff --git a/core/modules/history/history.library.yml b/core/modules/history/history.library.yml new file mode 100644 index 0000000..8154bf7 --- /dev/null +++ b/core/modules/history/history.library.yml @@ -0,0 +1,9 @@ +drupal.history: + version: VERSION + js: + - { file: js/history.js } + dependencies: + - core/jquery + - core/drupalSettings + - core/drupal + - core/drupal.ajax diff --git a/core/modules/history/history.module b/core/modules/history/history.module index 19056ad..b45074a 100644 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -182,24 +182,3 @@ function history_user_delete($account) { ->condition('uid', $account->id()) ->execute(); } - -/** - * Implements hook_library_info(). - */ -function history_library_info() { - $libraries['drupal.history'] = array( - 'title' => 'History', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'history') . '/js/history.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupalSettings'), - array('system', 'drupal'), - array('system', 'drupal.ajax'), - ), - ); - - return $libraries; -} diff --git a/core/modules/language/language.library.yml b/core/modules/language/language.library.yml new file mode 100644 index 0000000..4e46d3c --- /dev/null +++ b/core/modules/language/language.library.yml @@ -0,0 +1,8 @@ +language.admin: + version: VERSION + js: + - { file: language.admin.js } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once diff --git a/core/modules/language/language.module b/core/modules/language/language.module index b0dd216..c4c3a81 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -535,26 +535,6 @@ function language_delete($langcode) { } /** - * Implements hook_library_info(). - */ -function language_library_info() { - $libraries['language.admin'] = array( - 'title' => 'Language detection admin', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'language') . '/language.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - - return $libraries; -} - -/** * Implements hook_language_types_info(). * * Defines the three core language types: diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php index 912d657..2a51216 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php @@ -36,7 +36,7 @@ public static function getInfo() { * @see locale_library_info_alter() */ public function testLibraryInfoAlter() { - drupal_add_library('system', 'jquery.ui.datepicker'); + drupal_add_library('core', 'jquery.ui.datepicker'); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), 'locale.datepicker.js added to scripts.'); } diff --git a/core/modules/locale/locale.library.yml b/core/modules/locale/locale.library.yml new file mode 100644 index 0000000..106ffcc --- /dev/null +++ b/core/modules/locale/locale.library.yml @@ -0,0 +1,16 @@ +drupal.locale.admin: + version: VERSION + js: + - { file: locale.admin.js } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once +drupal.locale.datepicker: + version: VERSION + js: + - { file: locale.datepicker.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index e9b539c..59fd428 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -631,44 +631,12 @@ function locale_js_translate(array $files = array()) { } /** - * Implements hook_library_info(). - */ -function locale_library_info() { - $libraries['drupal.locale.admin'] = array( - 'title' => 'Locale', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'locale') . '/locale.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - $libraries['drupal.locale.datepicker'] = array( - 'title' => 'Locale Datepicker UI', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'locale') . '/locale.datepicker.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - ), - ); - - return $libraries; -} - -/** * Implement hook_library_info_alter(). * * Provides the language support for the jQuery UI Date Picker. */ function locale_library_info_alter(&$libraries, $module) { - if ($module == 'system' && isset($libraries['jquery.ui.datepicker'])) { + if ($module == 'core' && isset($libraries['jquery.ui.datepicker'])) { $language_interface = language(Language::TYPE_INTERFACE); // locale.datepicker.js should be added in the JS_LIBRARY group, so that // this attach behavior will execute early. JS_LIBRARY is the default for diff --git a/core/modules/menu/menu.library.yml b/core/modules/menu/menu.library.yml new file mode 100644 index 0000000..32dc303 --- /dev/null +++ b/core/modules/menu/menu.library.yml @@ -0,0 +1,15 @@ +drupal.menu: + version: VERSION + js: + - { file: menu.js } + dependencies: + - core/jquery + - core/drupal + - core/drupal.form +drupal.menu.admin: + version: VERSION + js: + - { file: menu.admin.js } + dependencies: + - core/jquery + - core/drupal diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 7fce53c..5903c81 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -686,34 +686,3 @@ function menu_preprocess_block(&$variables) { $variables['attributes']['role'] = 'navigation'; } } - -/** - * Implements hook_library_info(). - */ -function menu_library_info() { - $libraries['drupal.menu'] = array( - 'title' => 'Menu', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'menu') . '/menu.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupal.form'), - ), - ); - $libraries['drupal.menu.admin'] = array( - 'title' => 'Menu admin', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'menu') . '/menu.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - ), - ); - - return $libraries; -} diff --git a/core/modules/node/node.library.yml b/core/modules/node/node.library.yml new file mode 100644 index 0000000..e0fd4e9 --- /dev/null +++ b/core/modules/node/node.library.yml @@ -0,0 +1,24 @@ +drupal.node: + version: VERSION + js: + - { file: node.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.form +drupal.node.preview: + version: VERSION + js: + - { file: node.preview.js } + dependencies: + - core/jquery + - core/drupal +drupal.content_types: + version: VERSION + js: + - { file: content_types.js } + dependencies: + - core/jquery + - core/drupal + - core/drupal.form diff --git a/core/modules/node/node.module b/core/modules/node/node.module index a850c8a..f15c218 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -2000,50 +2000,6 @@ function node_language_delete($language) { } /** - * Implements hook_library_info(). - */ -function node_library_info() { - $libraries['drupal.node'] = array( - 'title' => 'Node', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'node') . '/node.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.form'), - ), - ); - $libraries['drupal.node.preview'] = array( - 'title' => 'Node preview', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'node') . '/node.preview.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - ), - ); - $libraries['drupal.content_types'] = array( - 'title' => 'Content types', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'node') . '/content_types.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupal.form'), - ), - ); - - return $libraries; -} - -/** * Marks a node to be re-indexed by the node_search plugin. * * @param int $nid diff --git a/core/modules/path/path.library.yml b/core/modules/path/path.library.yml new file mode 100644 index 0000000..c42039d --- /dev/null +++ b/core/modules/path/path.library.yml @@ -0,0 +1,8 @@ +drupal.path: + version: VERSION + js: + - { file: path.js } + dependencies: + - core/jquery + - core/drupal + - core/drupal.form diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 8e96610..5abff31 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -265,23 +265,3 @@ function path_entity_predelete(EntityInterface $entity) { \Drupal::service('path.crud')->delete(array('source' => $uri['path'])); } } - -/** - * Implements hook_library_info(). - */ -function path_library_info() { - $libraries['drupal.path'] = array( - 'title' => 'Path', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'path') . '/path.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupal.form'), - ), - ); - - return $libraries; -} diff --git a/core/modules/picture/picture.library.yml b/core/modules/picture/picture.library.yml new file mode 100644 index 0000000..eba44f5 --- /dev/null +++ b/core/modules/picture/picture.library.yml @@ -0,0 +1,6 @@ +picturefill: + version: VERSION + js: + - { file: picturefill/picturefill.js, type: file, weight: -10, group: 0 } + dependencies: + - core/matchmedia diff --git a/core/modules/picture/picture.module b/core/modules/picture/picture.module index 72f52a5..ba1ed96 100644 --- a/core/modules/picture/picture.module +++ b/core/modules/picture/picture.module @@ -72,24 +72,6 @@ function picture_menu() { } /** - * Implements hook_library_info(). - */ -function picture_library_info() { - $libraries['picturefill'] = array( - 'title' => t('Picturefill'), - 'website' => 'http://drupal.org/node/1775530', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'picture') . '/picturefill/picturefill.js' => array('type' => 'file', 'weight' => -10, 'group' => JS_DEFAULT), - ), - 'dependencies' => array( - array('system', 'matchmedia'), - ), - ); - return $libraries; -} - -/** * Load one picture by its identifier. * * @param int $id diff --git a/core/modules/shortcut/shortcut.library.yml b/core/modules/shortcut/shortcut.library.yml new file mode 100644 index 0000000..087784d --- /dev/null +++ b/core/modules/shortcut/shortcut.library.yml @@ -0,0 +1,13 @@ +drupal.shortcut.admin: + version: VERSION + js: + - { file: shortcut.admin.js } + dependencies: + - core/jquery + - core/drupal +drupal.shortcut: + version: VERSION + css: + - { file: css/shortcut.module.css } + - { file: css/shortcut.theme.css } + - { file: css/shortcut.icons.css } diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 8c7c869..d2957a0 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -475,32 +475,3 @@ function shortcut_toolbar() { return $items; } - -/** - * Implements hook_library_info(). - */ -function shortcut_library_info() { - $path = drupal_get_path('module', 'shortcut'); - $libraries['drupal.shortcut.admin'] = array( - 'title' => 'Shortcut configuration', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/shortcut.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - ), - ); - $libraries['drupal.shortcut'] = array( - 'title' => 'Shortcut UI', - 'version' => \Drupal::VERSION, - 'css' => array( - $path . '/css/shortcut.module.css' => array(), - $path . '/css/shortcut.theme.css' => array(), - $path . '/css/shortcut.icons.css' => array(), - ), - ); - - return $libraries; -} diff --git a/core/modules/simpletest/simpletest.library.yml b/core/modules/simpletest/simpletest.library.yml new file mode 100644 index 0000000..b934485 --- /dev/null +++ b/core/modules/simpletest/simpletest.library.yml @@ -0,0 +1,13 @@ +drupal.simpletest: + version: VERSION + js: + - { file: simpletest.js } + css: + - { file: css/simpletest.module.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/drupal.tableselect + - core/drupal.debounce diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index bd50676..04657af 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -698,32 +698,6 @@ function simpletest_mail_alter(&$message) { } /** - * Implements hook_library_info(). - */ -function simpletest_library_info() { - $libraries['drupal.simpletest'] = array( - 'title' => 'Simpletest', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'simpletest') . '/simpletest.js' => array(), - ), - 'css' => array( - drupal_get_path('module', 'simpletest') . '/css/simpletest.module.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - array('system', 'drupal.tableselect'), - array('system', 'drupal.debounce'), - ), - ); - - return $libraries; -} - -/** * Gets PHPUnit Classes. * * @param string $module diff --git a/core/modules/statistics/statistics.library.yml b/core/modules/statistics/statistics.library.yml new file mode 100644 index 0000000..b241fdb --- /dev/null +++ b/core/modules/statistics/statistics.library.yml @@ -0,0 +1,8 @@ +drupal.statistics: + version: VERSION + js: + - { file: statistics.js, scope: footer } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index a5fad17..12857ce 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -252,28 +252,6 @@ function statistics_preprocess_block(&$variables) { } /** - * Implements hook_library_info(). - */ -function statistics_library_info() { - $libraries['drupal.statistics'] = array( - 'title' => 'Statistics', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'statistics') . '/statistics.js' => array( - 'scope' => 'footer' - ), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - ), - ); - - return $libraries; -} - -/** * Implements hook_block_alter(). * * Removes the "popular" block from display if the module is not configured diff --git a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php index ceee2e2..48ad990e 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php +++ b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php @@ -107,7 +107,7 @@ public function preRender(&$values) { */ public function viewsForm(&$form, &$form_state) { // Add the tableselect javascript. - $form['#attached']['library'][] = array('system', 'drupal.tableselect'); + $form['#attached']['library'][] = array('core', 'drupal.tableselect'); // Only add the bulk form options and buttons if there are results. if (!empty($this->view->result)) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php index 3a11ccc..bf467b0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php @@ -77,7 +77,7 @@ function testAddFile() { */ function testAddSetting() { // Add a file in order to test default settings. - drupal_add_library('system', 'drupalSettings'); + drupal_add_library('core', 'drupalSettings'); $javascript = drupal_add_js(); $last_settings = reset($javascript['settings']['data']); $this->assertTrue(array_key_exists('currentPath', $last_settings), 'The current path JavaScript setting is set correctly.'); @@ -103,7 +103,7 @@ function testAddExternal() { function testAttributes() { $default_query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0'; - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('http://example.com/script.js', array('attributes' => array('defer' => 'defer'))); drupal_add_js('core/misc/collapse.js', array('attributes' => array('defer' => 'defer'))); $javascript = drupal_get_js(); @@ -124,7 +124,7 @@ function testAggregatedAttributes() { $default_query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0'; - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('http://example.com/script.js', array('attributes' => array('defer' => 'defer'))); drupal_add_js('core/misc/collapse.js', array('attributes' => array('defer' => 'defer'))); $javascript = drupal_get_js(); @@ -140,7 +140,7 @@ function testAggregatedAttributes() { * Tests drupal_get_js() for JavaScript settings. */ function testHeaderSetting() { - drupal_add_library('system', 'drupalSettings'); + drupal_add_library('core', 'drupalSettings'); $javascript = drupal_get_js('header'); $this->assertTrue(strpos($javascript, 'basePath') > 0, 'Rendered JavaScript header returns basePath setting.'); @@ -202,7 +202,7 @@ function testHeaderSetting() { * Tests to see if resetting the JavaScript empties the cache. */ function testReset() { - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('core/misc/collapse.js'); drupal_static_reset('drupal_add_js'); $this->assertEqual(array(), drupal_add_js(), 'Resetting the JavaScript correctly empties the cache.'); @@ -212,7 +212,7 @@ function testReset() { * Tests adding inline scripts. */ function testAddInline() { - drupal_add_library('system', 'jquery'); + drupal_add_library('core', 'jquery'); $inline = 'jQuery(function () { });'; $javascript = drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer')); $this->assertTrue(array_key_exists('core/assets/vendor/jquery/jquery.js', $javascript), 'jQuery is added when inline scripts are added.'); @@ -224,7 +224,7 @@ function testAddInline() { * Tests rendering an external JavaScript file. */ function testRenderExternal() { - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); $external = 'http://example.com/example.js'; drupal_add_js($external, 'external'); $javascript = drupal_get_js(); @@ -236,7 +236,7 @@ function testRenderExternal() { * Tests drupal_get_js() with a footer scope. */ function testFooterHTML() { - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); $inline = 'jQuery(function () { });'; drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer')); $javascript = drupal_get_js('footer'); @@ -247,7 +247,7 @@ function testFooterHTML() { * Tests drupal_add_js() sets preproccess to FALSE when cache is also FALSE. */ function testNoCache() { - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); $javascript = drupal_add_js('core/misc/collapse.js', array('cache' => FALSE)); $this->assertFalse($javascript['core/misc/collapse.js']['preprocess'], 'Setting cache to FALSE sets proprocess to FALSE when adding JavaScript.'); } @@ -256,7 +256,7 @@ function testNoCache() { * Tests adding a JavaScript file with a different group. */ function testDifferentGroup() { - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); $javascript = drupal_add_js('core/misc/collapse.js', array('group' => JS_THEME)); $this->assertEqual($javascript['core/misc/collapse.js']['group'], JS_THEME, 'Adding a JavaScript file with a different group caches the given group.'); } @@ -277,7 +277,7 @@ function testDifferentWeight() { function testBrowserConditionalComments() { $default_query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0'; - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('core/misc/collapse.js', array('browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE))); drupal_add_js('jQuery(function () { });', array('type' => 'inline', 'browsers' => array('IE' => FALSE))); $javascript = drupal_get_js(); @@ -293,7 +293,7 @@ function testBrowserConditionalComments() { * Tests JavaScript versioning. */ function testVersionQueryString() { - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('core/misc/collapse.js', array('version' => 'foo')); drupal_add_js('core/misc/ajax.js', array('version' => 'bar')); $javascript = drupal_get_js(); @@ -310,7 +310,7 @@ function testAggregation() { // ahead of ones without. The order of JavaScript execution must be the // same regardless of whether aggregation is enabled, so ensure this // expected order, first with aggregation off. - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('core/misc/ajax.js'); drupal_add_js('core/misc/collapse.js', array('every_page' => TRUE)); drupal_add_js('core/misc/autocomplete.js'); @@ -330,7 +330,7 @@ function testAggregation() { $config = \Drupal::config('system.performance'); $config->set('js.preprocess', 1); $config->save(); - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('core/misc/ajax.js'); drupal_add_js('core/misc/collapse.js', array('every_page' => TRUE)); drupal_add_js('core/misc/autocomplete.js'); @@ -353,7 +353,7 @@ function testAggregationOrder() { drupal_static_reset('drupal_add_js'); // Add two JavaScript files to the current request and build the cache. - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('core/misc/ajax.js'); drupal_add_js('core/misc/autocomplete.js'); @@ -374,7 +374,7 @@ function testAggregationOrder() { // Reset variables and add a file in a different scope first. \Drupal::state()->delete('system.js_cache_files'); drupal_static_reset('drupal_add_js'); - drupal_add_library('system', 'drupal'); + drupal_add_library('core', 'drupal'); drupal_add_js('some/custom/javascript_file.js', array('scope' => 'footer')); drupal_add_js('core/misc/ajax.js'); drupal_add_js('core/misc/autocomplete.js'); @@ -445,7 +445,7 @@ function testRenderDifferentWeight() { // JavaScript files are sorted first by group, then by the 'every_page' // flag, then by weight (see drupal_sort_css_js()), so to test the effect of // weight, we need the other two options to be the same. - drupal_add_library('system', 'jquery'); + drupal_add_library('core', 'jquery'); drupal_add_js('core/misc/collapse.js', array('group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => -21)); $javascript = drupal_get_js(); $this->assertTrue(strpos($javascript, 'core/misc/collapse.js') < strpos($javascript, 'core/assets/vendor/jquery/jquery.js'), 'Rendering a JavaScript file above jQuery.'); @@ -472,18 +472,12 @@ function testAlter() { * Adds a library to the page and tests for both its JavaScript and its CSS. */ function testLibraryRender() { - $result = drupal_add_library('system', 'jquery.farbtastic'); + $result = drupal_add_library('core', 'jquery.farbtastic'); $this->assertTrue($result !== FALSE, 'Library was added without errors.'); $scripts = drupal_get_js(); $styles = drupal_get_css(); $this->assertTrue(strpos($scripts, 'core/assets/vendor/farbtastic/farbtastic.js'), 'JavaScript of library was added to the page.'); $this->assertTrue(strpos($styles, 'core/assets/vendor/farbtastic/farbtastic.css'), 'Stylesheet of library was added to the page.'); - - drupal_add_library('common_test', 'shorthand.plugin'); - $path = drupal_get_path('module', 'common_test') . '/js/shorthand.js?v=0.8.3.37'; - $scripts = drupal_get_js(); - $this->assertTrue(strpos($scripts, $path), 'JavaScript specified in hook_library_info() using shorthand format (without any options) was added to the page.'); - $this->assertEqual(substr_count($scripts, 'shorthand.js'), 1, 'Shorthand JavaScript file only added once.'); } /** @@ -493,11 +487,11 @@ function testLibraryRender() { */ function testLibraryAlter() { // Verify that common_test altered the title of Farbtastic. - $library = drupal_get_library('system', 'jquery.farbtastic'); - $this->assertEqual($library['title'], 'Farbtastic: Altered Library', 'Registered libraries were altered.'); + $library = drupal_get_library('core', 'jquery.farbtastic'); + $this->assertEqual($library['version'], '0.0', 'Registered libraries were altered.'); // common_test_library_info_alter() also added a dependency on jQuery Form. - drupal_add_library('system', 'jquery.farbtastic'); + drupal_add_library('core', 'jquery.farbtastic'); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'core/assets/vendor/jquery-form/jquery.form.js'), 'Altered library dependencies are added to the page.'); } @@ -505,11 +499,11 @@ function testLibraryAlter() { /** * Tests that multiple modules can implement the same library. * - * @see common_test_library_info() + * @see common_test.library.yml */ function testLibraryNameConflicts() { $farbtastic = drupal_get_library('common_test', 'jquery.farbtastic'); - $this->assertEqual($farbtastic['title'], 'Custom Farbtastic Library', 'Alternative libraries can be added to the page.'); + $this->assertEqual($farbtastic['version'], '0.1', 'Alternative libraries can be added to the page.'); } /** @@ -530,7 +524,7 @@ function testLibraryUnknown() { * Tests the addition of libraries through the #attached['library'] property. */ function testAttachedLibrary() { - $element['#attached']['library'][] = array('system', 'jquery.farbtastic'); + $element['#attached']['library'][] = array('core', 'jquery.farbtastic'); drupal_render($element); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'core/assets/vendor/farbtastic/farbtastic.js'), 'The attached_library property adds the additional libraries.'); @@ -543,14 +537,14 @@ function testGetLibrary() { // Retrieve all libraries registered by a module. $libraries = drupal_get_library('common_test'); $this->assertTrue(isset($libraries['jquery.farbtastic']), 'Retrieved all module libraries.'); - // Retrieve all libraries for a module not implementing hook_library_info(). + // Retrieve all libraries for a module not declaring any libraries. // Note: This test installs language module. $libraries = drupal_get_library('dblog'); - $this->assertEqual($libraries, array(), 'Retrieving libraries from a module not implementing hook_library_info() returns an emtpy array.'); + $this->assertEqual($libraries, array(), 'Retrieving libraries from a module not declaring any libraries returns an emtpy array.'); // Retrieve a specific library by module and name. $farbtastic = drupal_get_library('common_test', 'jquery.farbtastic'); - $this->assertEqual($farbtastic['version'], '5.3', 'Retrieved a single library.'); + $this->assertEqual($farbtastic['version'], '0.1', 'Retrieved a single library.'); // Retrieve a non-existing library by module and name. $farbtastic = drupal_get_library('common_test', 'foo'); $this->assertIdentical($farbtastic, FALSE, 'Retrieving a non-existing library returns FALSE.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php index 07c77d0..3f806f3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php @@ -14,13 +14,6 @@ */ class MergeAttachmentsTest extends DrupalUnitTestBase { - /** - * Modules to enable. - * - * @var array - */ - public static $modules = array('system'); - public static function getInfo() { return array( 'name' => 'Attachment merging', @@ -29,30 +22,26 @@ public static function getInfo() { ); } - function setUp() { - parent::setUp(); - } - /** * Tests justs library asset merging. */ function testLibraryMerging() { $a['#attached'] = array( 'library' => array( - array('system', 'drupal'), - array('system', 'drupalSettings'), + array('core', 'drupal'), + array('core', 'drupalSettings'), ), ); $b['#attached'] = array( 'library' => array( - array('system', 'jquery'), + array('core', 'jquery'), ), ); $expected['#attached'] = array( 'library' => array( - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery'), + array('core', 'drupal'), + array('core', 'drupalSettings'), + array('core', 'jquery'), ), ); $this->assertIdentical($expected['#attached'], drupal_merge_attached($a['#attached'], $b['#attached']), 'Attachments merged correctly.'); @@ -60,22 +49,22 @@ function testLibraryMerging() { // Merging in the opposite direction yields the opposite library order. $expected['#attached'] = array( 'library' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), + array('core', 'jquery'), + array('core', 'drupal'), + array('core', 'drupalSettings'), ), ); $this->assertIdentical($expected['#attached'], drupal_merge_attached($b['#attached'], $a['#attached']), 'Attachments merged correctly; opposite merging yields opposite order.'); // Merging with duplicates: duplicates are simply retained, it's up to the // rest of the system to handle duplicates. - $b['#attached']['library'][] = array('system', 'drupalSettings'); + $b['#attached']['library'][] = array('core', 'drupalSettings'); $expected['#attached'] = array( 'library' => array( - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery'), - array('system', 'drupalSettings'), + array('core', 'drupal'), + array('core', 'drupalSettings'), + array('core', 'jquery'), + array('core', 'drupalSettings'), ), ); $this->assertIdentical($expected['#attached'], drupal_merge_attached($a['#attached'], $b['#attached']), 'Attachments merged correctly; duplicates are retained.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/NoJavaScriptAnonymousTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/NoJavaScriptAnonymousTest.php index 76b941a..a13e38a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/NoJavaScriptAnonymousTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/NoJavaScriptAnonymousTest.php @@ -65,16 +65,11 @@ protected function assertNoJavaScriptExceptHtml5Shiv() { $this->assertNoRaw('var drupalSettings = {', 'drupalSettings is not set.'); // Ensure the HTML5 shiv exists. - $system_libraries = system_library_info(); - $html5_shiv_version = $system_libraries['html5shiv']['version']; - $html5_shiv_markup = 'core/assets/vendor/html5shiv/html5.js?v=' . $html5_shiv_version . '">'; - $this->assertRaw($html5_shiv_markup, 'HTML5 shiv JavaScript exists.'); + $this->assertRaw('html5shiv/html5.js', 'HTML5 shiv JavaScript exists.'); // Ensure no other JavaScript file exists on the page, while ignoring the // HTML5 shiv. - $content = $this->drupalGetContent(); - $this->drupalSetContent(str_replace($html5_shiv_markup, '', $content)); - $this->assertNoRaw('.js', "No other JavaScript exists."); + $this->assertNoPattern('/(? 'setting', 'data' => array('foo' => 'bar')) ), 'library' => array( - array('system', 'drupal.collapse'), - array('system', 'drupal.collapse'), + array('core', 'drupal.collapse'), + array('core', 'drupal.collapse'), ), ), '#post_render_cache' => array( @@ -661,8 +661,8 @@ function testDrupalRenderChildrenPostRenderCache() { array('type' => 'setting', 'data' => array('foo' => 'bar')) ), 'library' => array( - array('system', 'drupal.collapse'), - array('system', 'drupal.collapse'), + array('core', 'drupal.collapse'), + array('core', 'drupal.collapse'), ), ), '#post_render_cache' => array( @@ -679,7 +679,7 @@ function testDrupalRenderChildrenPostRenderCache() { ', '#attached' => array( 'library' => array( - array('system', 'drupal.collapse'), + array('core', 'drupal.collapse'), ), ), '#post_render_cache' => array( diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index cabea75..ca12d22 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -280,81 +280,6 @@ function hook_js_alter(&$javascript) { } /** - * Registers JavaScript/CSS libraries associated with a module. - * - * Modules implementing this return an array of arrays. The key to each - * sub-array is the machine readable name of the library. Each library may - * contain the following items: - * - * - 'title': The human readable name of the library. - * - 'website': The URL of the library's web site. - * - 'version': A string specifying the version of the library; intentionally - * not a float because a version like "1.2.3" is not a valid float. Use PHP's - * version_compare() to compare different versions. - * - 'js': An array of JavaScript elements; each element's key is used as $data - * argument, each element's value is used as $options array for - * drupal_add_js(). To add library-specific (not module-specific) JavaScript - * settings, the key may be skipped, the value must specify - * 'type' => 'setting', and the actual settings must be contained in a 'data' - * element of the value. - * - 'css': Like 'js', an array of CSS elements passed to drupal_add_css(). - * - 'dependencies': An array of libraries that are required for a library. Each - * element is an array listing the module and name of another library. Note - * that all dependencies for each dependent library will also be added when - * this library is added. - * - * Registered information for a library should contain re-usable data only. - * Module- or implementation-specific data and integration logic should be added - * separately. - * - * @return - * An array defining libraries associated with a module. - * - * @see system_library_info() - * @see drupal_add_library() - * @see drupal_get_library() - */ -function hook_library_info() { - // Library One. - $libraries['library-1'] = array( - 'title' => 'Library One', - 'website' => 'http://example.com/library-1', - 'version' => '1.2', - 'js' => array( - drupal_get_path('module', 'my_module') . '/library-1.js' => array(), - ), - 'css' => array( - drupal_get_path('module', 'my_module') . '/library-2.css' => array( - 'type' => 'file', - 'media' => 'screen', - ), - ), - ); - // Library Two. - $libraries['library-2'] = array( - 'title' => 'Library Two', - 'website' => 'http://example.com/library-2', - 'version' => '3.1-beta1', - 'js' => array( - // JavaScript settings may use the 'data' key. - array( - 'type' => 'setting', - 'data' => array('library2' => TRUE), - ), - ), - 'dependencies' => array( - // Require jQuery UI core by System module. - array('system', 'jquery.ui.core'), - // Require our other library. - array('my_module', 'library-1'), - // Require another library. - array('other_module', 'library-3'), - ), - ); - return $libraries; -} - -/** * Alters the JavaScript/CSS library registry. * * Allows certain, contributed modules to update libraries to newer versions @@ -367,12 +292,10 @@ function hook_library_info() { * name and passed by reference. * @param $module * The name of the module that registered the libraries. - * - * @see hook_library_info() */ function hook_library_info_alter(&$libraries, $module) { // Update Farbtastic to version 2.0. - if ($module == 'system' && isset($libraries['farbtastic'])) { + if ($module == 'core' && isset($libraries['farbtastic'])) { // Verify existing version is older than the one we are updating to. if (version_compare($libraries['farbtastic']['version'], '2.0', '<')) { // Update the existing Farbtastic to version 2.0. diff --git a/core/modules/system/system.library.yml b/core/modules/system/system.library.yml new file mode 100644 index 0000000..fcd4fcb --- /dev/null +++ b/core/modules/system/system.library.yml @@ -0,0 +1,17 @@ +drupal.system: + version: VERSION + js: + - { file: system.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once +drupal.system.modules: + version: VERSION + js: + - { file: system.modules.js } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once diff --git a/core/modules/system/system.module b/core/modules/system/system.module index f4bf194..02520d2 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -854,1007 +854,6 @@ function system_theme_suggestions_region(array $variables) { } /** - * Implements hook_library_info(). - */ -function system_library_info() { - // Drupal-specific JavaScript. - $libraries['drupal'] = array( - 'title' => 'Drupal', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/drupal.js' => array('group' => JS_LIBRARY, 'weight' => -18), - ), - 'dependencies' => array( - array('system', 'domready'), - ), - ); - - // Drupal settings. - $libraries['drupalSettings'] = array( - 'title' => 'Drupal Settings', - 'version' => \Drupal::VERSION, - 'js' => array( - array('type' => 'setting', 'data' => array()), - ), - ); - - // Drupal's Ajax framework. - $libraries['drupal.ajax'] = array( - 'title' => 'Drupal AJAX', - 'website' => 'http://api.drupal.org/api/group/ajax/8', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/ajax.js' => array('group' => JS_LIBRARY, 'weight' => 2), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.progress'), - array('system', 'jquery.once'), - ), - ); - - // Drupal's Screen Reader change announcement utility. - $libraries['drupal.announce'] = array( - 'title' => 'Drupal announce', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/announce.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - array('system', 'drupal'), - array('system', 'drupal.debounce'), - ), - ); - - // Drupal's batch API. - $libraries['drupal.batch'] = array( - 'title' => 'Drupal batch API', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/batch.js' => array('group' => JS_DEFAULT, 'cache' => FALSE), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.ajax'), - array('system', 'drupal.progress'), - array('system', 'jquery.once'), - ), - ); - - // Drupal's progress indicator. - $libraries['drupal.progress'] = array( - 'title' => 'Drupal progress indicator', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/progress.js' => array('group' => JS_DEFAULT), - ), - 'dependencies' => array( - array('system', 'drupal'), - array('system', 'jquery'), - array('system', 'drupalSettings'), - ), - ); - - // Drupal's form library. - $libraries['drupal.form'] = array( - 'title' => 'Drupal form library', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/form.js' => array('group' => JS_LIBRARY, 'weight' => 1), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.cookie'), - array('system', 'jquery.once'), - ), - ); - - // Drupal's dialog component. - $libraries['drupal.dialog'] = array( - 'title' => 'Drupal Dialog', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/dialog.js' => array('group' => JS_LIBRARY), - 'core/misc/dialog.position.js' => array('group' => JS_LIBRARY), - ), - 'css' => array( - 'core/misc/dialog.theme.css' => array('weight' => 1), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.debounce'), - array('system', 'drupal.displace'), - array('system', 'jquery.ui.dialog'), - ), - ); - - // Drupal's integration between AJAX and dialogs. - $libraries['drupal.dialog.ajax'] = array( - 'title' => 'Drupal Dialog AJAX', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/dialog.ajax.js' => array('group' => JS_LIBRARY, 'weight' => 3), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.ajax'), - array('system', 'drupal.dialog'), - ), - ); - - // Drupal's states library. - $libraries['drupal.states'] = array( - 'title' => 'Drupal states', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/states.js' => array('group' => JS_LIBRARY, 'weight' => 1), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - ), - ); - - // Drupal's tabledrag library. - $libraries['drupal.tabledrag'] = array( - 'title' => 'Drupal tabledrag', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/tabledrag.js' => array('group' => JS_LIBRARY, 'weight' => -1), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'modernizr'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - array('system', 'jquery.cookie'), - ), - ); - - // Drupal's responsive table API. - $libraries['drupal.tableresponsive'] = array( - 'title' => 'Drupal responsive table API', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/tableresponsive.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - - // Collapsible details. - $libraries['drupal.collapse'] = array( - 'title' => 'Collapsible details', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/collapse.js' => array('group' => JS_DEFAULT), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'modernizr'), - array('system', 'drupal'), - // collapse.js relies on drupalGetSummary in form.js - array('system', 'drupal.form'), - array('system', 'jquery.once'), - ), - ); - - // Drupal's autocomplete widget. - $libraries['drupal.autocomplete'] = array( - 'title' => 'Drupal autocomplete', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/autocomplete.js' => array('group' => JS_LIBRARY, 'weight' => -1), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.ajax'), - array('system', 'jquery.ui.autocomplete'), - ), - ); - - // A utility that measures and reports viewport offset dimensions from - // elements like the toolbar that can potentially displace the positioning of - // elements. - $libraries['drupal.displace'] = array( - 'title' => 'Drupal displace', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/displace.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupal.debounce'), - ), - ); - - // Manages tab orders in the document. - $libraries['drupal.tabbingmanager'] = array( - 'title' => 'Drupal tabbing manager', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/tabbingmanager.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - array('system', 'jquery'), - // Depends on jQuery UI Core to use the ":tabbable" pseudo selector. - array('system', 'jquery.ui.core'), - array('system', 'drupal'), - ), - ); - - // A utility function to limit calls to a function with a given time. - $libraries['drupal.debounce'] = array( - 'title' => 'Drupal debounce', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/debounce.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - // @todo remove drupal dependency. - array('system', 'drupal'), - ), - ); - - // domReady. - $libraries['domready'] = array( - 'title' => 'domReady', - 'website' => 'https://github.com/ded/domready', - 'version' => 'master', - 'js' => array( - 'core/assets/vendor/domready/ready.min.js' => array('group' => JS_LIBRARY, 'weight' => -21), - ), - ); - - // jQuery. - $libraries['jquery'] = array( - 'title' => 'jQuery', - 'website' => 'http://jquery.com', - 'version' => '2.0.3', - 'js' => array( - 'core/assets/vendor/jquery/jquery.js' => array('group' => JS_LIBRARY, 'weight' => -20), - ), - ); - - // jQuery Once. - $libraries['jquery.once'] = array( - 'title' => 'jQuery Once', - 'website' => 'http://plugins.jquery.com/once/', - 'version' => '1.2.3', - 'js' => array( - 'core/assets/vendor/jquery-once/jquery.once.js' => array('group' => JS_LIBRARY, 'weight' => -19), - ), - 'dependencies' => array( - array('system', 'jquery'), - ), - ); - - // jQuery Form Plugin. - $libraries['jquery.form'] = array( - 'title' => 'jQuery Form Plugin', - 'website' => 'http://malsup.com/jquery/form/', - 'version' => '3.39', - 'js' => array( - 'core/assets/vendor/jquery-form/jquery.form.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'jquery.cookie'), - ), - ); - - // jQuery BBQ plugin. - $libraries['jquery.bbq'] = array( - 'title' => 'jQuery BBQ', - 'website' => 'http://benalman.com/projects/jquery-bbq-plugin/', - 'version' => '1.3pre', - 'js' => array( - 'core/assets/vendor/jquery-bbq/jquery.ba-bbq.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - ), - ); - - // Dropbutton. - $libraries['drupal.dropbutton'] = array( - 'title' => 'Dropbutton', - 'website' => 'http://drupal.org/node/1608878', - 'version' => '1.0', - 'js' => array( - 'core/misc/dropbutton/dropbutton.js' => array(), - ), - 'css' => array( - 'core/misc/dropbutton/dropbutton.css' => array(), - 'core/misc/dropbutton/dropbutton.theme.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - ), - ); - - // Vertical Tabs. - $libraries['drupal.vertical-tabs'] = array( - 'title' => 'Vertical Tabs', - 'website' => 'http://drupal.org/node/323112', - 'version' => '1.0', - 'js' => array( - 'core/misc/vertical-tabs.js' => array(), - ), - 'css' => array( - 'core/misc/vertical-tabs.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - // Vertical tabs relies on drupalGetSummary in form.js - array('system', 'drupal.form'), - ), - ); - - // matchMedia polyfill. - $libraries['matchmedia'] = array( - 'title' => 'window.matchMedia polyfill', - 'website' => 'http://drupal.org/node/1815602', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/matchmedia.js' => array(), - ), - 'dependencies' => array( - array('system', 'drupal.debounce'), - ), - ); - - // Farbtastic. - $libraries['jquery.farbtastic'] = array( - 'title' => 'Farbtastic', - 'website' => 'http://code.google.com/p/farbtastic/', - 'version' => '1.2', - 'js' => array( - 'core/assets/vendor/farbtastic/farbtastic.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/farbtastic/farbtastic.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - ), - ); - - // HTML5 Shiv. - $libraries['html5shiv'] = array( - 'title' => 'html5shiv', - 'website' => 'https://github.com/aFarkas/html5shiv/', - 'version' => '3.6.2', - 'js' => array( - 'core/assets/vendor/html5shiv/html5.js' => array( - 'group' => JS_LIBRARY, - 'weight' => -22, - 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), - ), - ), - ); - - // Modernizr. - $libraries['modernizr'] = array( - 'title' => 'Modernizr', - 'website' => 'http://modernizr.com/', - 'version' => '2.6.2', - 'js' => array( - 'core/assets/vendor/modernizr/modernizr.min.js' => array( - 'every_page' => TRUE, - 'group' => JS_LIBRARY, - 'preprocess' => 0, - 'scope' => 'header', - 'weight' => -21, - ), - ), - ); - - // Normalize. - $libraries['normalize'] = array( - 'title' => 'normalize.css', - 'website' => 'http://git.io/normalize', - 'version' => '2.1.2', - 'css' => array( - 'core/assets/vendor/normalize-css/normalize.css' => array( - 'every_page' => TRUE, - 'weight' => CSS_BASE - 20, - ), - ), - ); - - // jQuery UI. - $libraries['jquery.ui.core'] = array( - 'title' => 'jQuery UI: Core', - 'website' => 'http://jqueryui.com', - 'version' => '1.10.2', - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.core.js' => array('group' => JS_LIBRARY, 'weight' => -11), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.core.css' => array(), - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.theme.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - ), - ); - $libraries['jquery.ui.accordion'] = array( - 'title' => 'jQuery UI: Accordion', - 'website' => 'http://jqueryui.com/demos/accordion/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.accordion.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.accordion.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.autocomplete'] = array( - 'title' => 'jQuery UI: Autocomplete', - 'website' => 'http://jqueryui.com/demos/autocomplete/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.autocomplete.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.autocomplete.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - array('system', 'jquery.ui.position'), - array('system', 'jquery.ui.menu'), - ), - ); - $libraries['jquery.ui.button'] = array( - 'title' => 'jQuery UI: Button', - 'website' => 'http://jqueryui.com/demos/button/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.button.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.button.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.datepicker'] = array( - 'title' => 'jQuery UI: Date Picker', - 'website' => 'http://jqueryui.com/demos/datepicker/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.datepicker.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.datepicker.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - ), - ); - $libraries['jquery.ui.dialog'] = array( - 'title' => 'jQuery UI: Dialog', - 'website' => 'http://jqueryui.com/demos/dialog/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.dialog.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.dialog.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - array('system', 'jquery.ui.button'), - array('system', 'jquery.ui.draggable'), - array('system', 'jquery.ui.mouse'), - array('system', 'jquery.ui.position'), - array('system', 'jquery.ui.resizable'), - ), - ); - $libraries['jquery.ui.draggable'] = array( - 'title' => 'jQuery UI: Draggable', - 'website' => 'http://jqueryui.com/demos/draggable/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.draggable.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.mouse'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.droppable'] = array( - 'title' => 'jQuery UI: Droppable', - 'website' => 'http://jqueryui.com/demos/droppable/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.droppable.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - array('system', 'jquery.ui.mouse'), - array('system', 'jquery.ui.draggable'), - ), - ); - $libraries['jquery.ui.menu'] = array( - 'title' => 'jQuery UI: Mouse', - 'website' => 'http://docs.jquery.com/UI/Menu', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.menu.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.menu.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.mouse'] = array( - 'title' => 'jQuery UI: Mouse', - 'website' => 'http://docs.jquery.com/UI/Mouse', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.mouse.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.position'] = array( - 'title' => 'jQuery UI: Position', - 'website' => 'http://jqueryui.com/demos/position/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.position.js' => array(), - ), - ); - $libraries['jquery.ui.progressbar'] = array( - 'title' => 'jQuery UI: Progress Bar', - 'website' => 'http://jqueryui.com/demos/progressbar/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.progressbar.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.progressbar.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.resizable'] = array( - 'title' => 'jQuery UI: Resizable', - 'website' => 'http://jqueryui.com/demos/resizable/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.resizable.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.resizable.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - array('system', 'jquery.ui.mouse'), - ), - ); - $libraries['jquery.ui.selectable'] = array( - 'title' => 'jQuery UI: Selectable', - 'website' => 'http://jqueryui.com/demos/selectable/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.selectable.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.selectable.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.mouse'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.slider'] = array( - 'title' => 'jQuery UI: Slider', - 'website' => 'http://jqueryui.com/demos/slider/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.slider.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.slider.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.mouse'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.sortable'] = array( - 'title' => 'jQuery UI: Sortable', - 'website' => 'http://jqueryui.com/demos/sortable/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.sortable.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.mouse'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.spinner'] = array( - 'title' => 'jQuery UI: Spinner', - 'website' => 'http://jqueryui.com/demos/spinner/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.spinner.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - array('system', 'jquery.ui.button'), - ), - ); - $libraries['jquery.ui.tabs'] = array( - 'title' => 'jQuery UI: Tabs', - 'website' => 'http://jqueryui.com/demos/tabs/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.tabs.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.tabs.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - ), - ); - $libraries['jquery.ui.tooltip'] = array( - 'title' => 'jQuery UI: Tooltip', - 'website' => 'http://jqueryui.com/demos/tooltip/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.tooltip.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/jquery.ui/themes/base/jquery.ui.tooltip.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - array('system', 'jquery.ui.widget'), - array('system', 'jquery.ui.position'), - ), - ); - $libraries['jquery.ui.widget'] = array( - 'title' => 'jQuery UI: Widget', - 'website' => 'http://docs.jquery.com/UI/Widget', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.ui.widget.js' => array('group' => JS_LIBRARY, 'weight' => -10), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - ), - ); - $libraries['jquery.effects.core'] = array( - 'title' => 'jQuery UI: Effects', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.core.js' => array('group' => JS_LIBRARY, 'weight' => -9), - ), - ); - $libraries['jquery.effects.blind'] = array( - 'title' => 'jQuery UI: Effects Blind', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.blind.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.bounce'] = array( - 'title' => 'jQuery UI: Effects Bounce', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.bounce.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.clip'] = array( - 'title' => 'jQuery UI: Effects Clip', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.clip.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.drop'] = array( - 'title' => 'jQuery UI: Effects Drop', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.drop.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.explode'] = array( - 'title' => 'jQuery UI: Effects Explode', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.explode.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.fade'] = array( - 'title' => 'jQuery UI: Effects Fade', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.fade.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.fold'] = array( - 'title' => 'jQuery UI: Effects Fold', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.fold.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.highlight'] = array( - 'title' => 'jQuery UI: Effects Highlight', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.highlight.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.pulsate'] = array( - 'title' => 'jQuery UI: Effects Pulsate', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.pulsate.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.scale'] = array( - 'title' => 'jQuery UI: Effects Scale', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.scale.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.shake'] = array( - 'title' => 'jQuery UI: Effects Shake', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.shake.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.slide'] = array( - 'title' => 'jQuery UI: Effects Slide', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.slide.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - $libraries['jquery.effects.transfer'] = array( - 'title' => 'jQuery UI: Effects Transfer', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => $libraries['jquery.ui.core']['version'], - 'js' => array( - 'core/assets/vendor/jquery.ui/ui/jquery.effects.transfer.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.effects.core'), - ), - ); - - // Touch Punch for jQuery UI touch support. - $libraries['jquery.ui.touch-punch'] = array( - 'title' => 'jQuery UI Touch Punch', - 'website' => 'http://jqueryui.com/demos/effect/', - 'version' => '0.2.2', - 'js' => array( - 'core/assets/vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery.ui.core'), - ), - ); - - // Underscore. - $libraries['underscore'] = array( - 'title' => 'Underscore.js', - 'website' => 'http://underscorejs.org/', - 'version' => '1.4.0', - 'js' => array( - 'core/assets/vendor/underscore/underscore.js' => array('group' => JS_LIBRARY, 'weight' => -20), - ), - ); - - // Backbone. - $libraries['backbone'] = array( - 'title' => 'Backbone.js', - 'website' => 'http://backbonejs.org/', - 'version' => '0.9.2', - 'js' => array( - 'core/assets/vendor/backbone/backbone.js' => array('group' => JS_LIBRARY, 'weight' => -19), - ), - 'dependencies' => array( - array('system', 'underscore'), - ), - ); - - // Cookie. - $libraries['jquery.cookie'] = array( - 'title' => 'Cookie', - 'website' => 'http://plugins.jquery.com/project/cookie', - 'version' => $libraries['jquery.ui.core']['version'], // Shipped with jQuery UI. - 'js' => array( - 'core/assets/vendor/jquery.ui/external/jquery.cookie.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - ), - ); - $libraries['drupal.tableselect'] = array( - 'title' => 'Tableselect', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/tableselect.js' => array(), - ), - 'dependencies' => array( - array('system', 'drupal'), - array('system', 'jquery'), - ), - ); - $libraries['drupal.tableheader'] = array( - 'title' => 'Table header', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/tableheader.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - array('system', 'drupal.displace'), - ), - ); - $libraries['drupal.timezone'] = array( - 'title' => 'Timezone', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/timezone.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - ), - ); - $libraries['drupal.machine-name'] = array( - 'title' => 'Machine name', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/machine-name.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'jquery.once'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - ), - ); - - $libraries['drupal.system'] = array( - 'title' => 'System', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'system') . '/system.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - ), - ); - $libraries['drupal.system.modules'] = array( - 'title' => 'System modules', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'system') . '/system.modules.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - - return $libraries; -} - -/** * Implements hook_stream_wrappers(). */ function system_stream_wrappers() { @@ -2093,7 +1092,7 @@ function system_filetransfer_info() { */ function system_page_build(&$page) { // Ensure the same CSS is loaded in template_preprocess_maintenance_page(). - $page['#attached']['library'][] = array('system', 'normalize'); + $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( @@ -2173,7 +1172,7 @@ function system_user_timezone(&$form, &$form_state) { if (!$account->getTimezone() && $account->id() == $user->id() && empty($form_state['input']['timezone'])) { $form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.'); $form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect')); - drupal_add_library('system', 'drupal.timezone'); + drupal_add_library('core', 'drupal.timezone'); } } diff --git a/core/modules/system/tests/modules/common_test/common_test.library.yml b/core/modules/system/tests/modules/common_test/common_test.library.yml new file mode 100644 index 0000000..4a2381d --- /dev/null +++ b/core/modules/system/tests/modules/common_test/common_test.library.yml @@ -0,0 +1,8 @@ +jquery.farbtastic: + version: 0.1 + js: + - { file: assets/vendor/farbtastic/farbtastic.js } + css: + - { file: assets/vendor/farbtastic/farbtastic.css } + dependencies: + - core/jquery diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module index b3b8ad8..44a84ef 100644 --- a/core/modules/system/tests/modules/common_test/common_test.module +++ b/core/modules/system/tests/modules/common_test/common_test.module @@ -139,53 +139,15 @@ function theme_common_test_empty($variables) { * Implements hook_library_info_alter(). */ function common_test_library_info_alter(&$libraries, $module) { - if ($module == 'system' && isset($libraries['jquery.farbtastic'])) { - // Change the title of Farbtastic to "Farbtastic: Altered Library". - $libraries['jquery.farbtastic']['title'] = 'Farbtastic: Altered Library'; + if ($module == 'core' && isset($libraries['jquery.farbtastic'])) { + // Change the version of Farbtastic to 0.0. + $libraries['jquery.farbtastic']['version'] = '0.0'; // Make Farbtastic depend on jQuery Form to test library dependencies. - $libraries['jquery.farbtastic']['dependencies'][] = array('system', 'jquery.form'); + $libraries['jquery.farbtastic']['dependencies'][] = array('core', 'jquery.form'); } } /** - * Implements hook_library_info(). - * - * Adds Farbtastic in a different version. - */ -function common_test_library_info() { - $libraries['jquery.farbtastic'] = array( - 'title' => 'Custom Farbtastic Library', - 'website' => 'http://code.google.com/p/farbtastic/', - 'version' => '5.3', - 'js' => array( - 'core/assets/vendor/farbtastic/farbtastic.js' => array(), - ), - 'css' => array( - 'core/assets/vendor/farbtastic/farbtastic.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - ), - ); - // Nominate a library using the shorthand format, where no options are given, - // just the file name. - $libraries['shorthand.plugin'] = array( - 'title' => 'Shorthand Plugin', - 'website' => 'http://www.example.com/', - 'version' => '0.8.3.37', - 'js' => array( - // Here we attach the JavaScript file using the shorthand format, only - // the file name is given, no options. - drupal_get_path('module', 'common_test') . '/js/shorthand.js', - ), - 'dependencies' => array( - array('system', 'jquery'), - ), - ); - return $libraries; -} - -/** * Implements hook_cron(). * * System module should handle if a module does not catch an exception and keep diff --git a/core/modules/taxonomy/taxonomy.library.yml b/core/modules/taxonomy/taxonomy.library.yml new file mode 100644 index 0000000..300f5d5 --- /dev/null +++ b/core/modules/taxonomy/taxonomy.library.yml @@ -0,0 +1,11 @@ +drupal.taxonomy: + version: VERSION + js: + - { file: taxonomy.js } + css: + - { file: css/taxonomy.module.css } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.tabledrag diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 978ac62..1656bc0 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -950,27 +950,3 @@ function taxonomy_taxonomy_term_delete(Term $term) { /** * @} End of "defgroup taxonomy_index". */ - -/** - * Implements hook_library_info(). - */ -function taxonomy_library_info() { - $libraries['drupal.taxonomy'] = array( - 'title' => 'Taxonomy', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'taxonomy') . '/taxonomy.js' => array(), - ), - 'css' => array( - drupal_get_path('module', 'taxonomy') . '/css/taxonomy.module.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.tabledrag'), - ), - ); - - return $libraries; -} diff --git a/core/modules/text/text.library.yml b/core/modules/text/text.library.yml new file mode 100644 index 0000000..8328f09 --- /dev/null +++ b/core/modules/text/text.library.yml @@ -0,0 +1,8 @@ +drupal.text: + version: VERSION + js: + - { file: text.js } + dependencies: + - core/jquery + - core/jquery.once + - core/drupal diff --git a/core/modules/text/text.module b/core/modules/text/text.module index 675c63e..81d46a9 100644 --- a/core/modules/text/text.module +++ b/core/modules/text/text.module @@ -8,26 +8,6 @@ use Drupal\Core\Entity\EntityInterface; /** - * Implements hook_library_info(). - */ -function text_library_info() { - $libraries['drupal.text'] = array( - 'title' => 'Text', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'text') . '/text.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'jquery.once'), - array('system', 'drupal'), - ), - ); - - return $libraries; -} - -/** * Implements hook_help(). */ function text_help($path, $arg) { diff --git a/core/modules/toolbar/toolbar.library.yml b/core/modules/toolbar/toolbar.library.yml new file mode 100644 index 0000000..f7ef629 --- /dev/null +++ b/core/modules/toolbar/toolbar.library.yml @@ -0,0 +1,38 @@ +toolbar: + version: VERSION + js: + - { file: js/toolbar.js } + css: + - { file: css/toolbar.module.css } + - { file: css/toolbar.theme.css } + - { file: css/toolbar.icons.css } + dependencies: + - core/modernizr + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.announce + - core/backbone + - core/matchmedia + - core/jquery.once + - core/drupal.displace + - toolbar/toolbar.menu +toolbar.menu: + version: VERSION + js: + - { file: js/toolbar.menu.js } + css: + - { file: css/toolbar.menu.css } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once +toolbar.escapeAdmin: + version: VERSION + js: + - { file: js/escapeAdmin.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index c8612df..c5cb26a 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -559,67 +559,6 @@ function toolbar_get_rendered_subtrees() { } /** - * Implements hook_library_info(). - */ -function toolbar_library_info() { - $libraries['toolbar'] = array( - 'title' => 'Toolbar', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'toolbar') . '/js/toolbar.js' => array(), - ), - 'css' => array( - drupal_get_path('module', 'toolbar') . '/css/toolbar.module.css', - drupal_get_path('module', 'toolbar') . '/css/toolbar.theme.css', - drupal_get_path('module', 'toolbar') . '/css/toolbar.icons.css', - ), - 'dependencies' => array( - array('system', 'modernizr'), - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'drupal.announce'), - array('system', 'backbone'), - array('system', 'matchmedia'), - array('system', 'jquery.once'), - array('system', 'drupal.displace'), - array('toolbar', 'toolbar.menu'), - ), - ); - - $libraries['toolbar.menu'] = array( - 'title' => 'Toolbar nested accordion menus.', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'toolbar') . '/js/toolbar.menu.js' => array(), - ), - 'css' => array( - drupal_get_path('module', 'toolbar') . '/css/toolbar.menu.css', - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - $libraries['toolbar.escapeAdmin'] = array( - 'title' => 'Provides a button to escape the administration area.', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'toolbar') . '/js/escapeAdmin.js', - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - ), - ); - - return $libraries; -} - -/** * Returns the hash of the per-user rendered toolbar subtrees. * * @return string diff --git a/core/modules/tour/tour.library.yml b/core/modules/tour/tour.library.yml new file mode 100644 index 0000000..2ee0fba --- /dev/null +++ b/core/modules/tour/tour.library.yml @@ -0,0 +1,23 @@ +tour: + version: VERSION + js: + - { file: js/tour.js, group: -100 } + dependencies: + - core/jquery + - core/drupal + - core/backbone + - tour/jquery.joyride + - tour/tour-styling +tour-styling: + version: VERSION + css: + - { file: css/tour.module.css, media: screen } +jquery.joyride: + version: VERSION + js: + - { file: js/jquery.joyride-2.0.3.js } + css: + - { file: css/joyride-2.0.3.css, media: screen } + dependencies: + - core/jquery + - core/jquery.cookie diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index 8bd9ec1..e24f5f9 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -19,54 +19,6 @@ function tour_permission() { } /** - * Implements hook_library_info(). - */ -function tour_library_info() { - $path = drupal_get_path('module', 'tour'); - - $libraries['tour'] = array( - 'title' => 'Tour', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/tour.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'backbone'), - array('tour', 'jquery.joyride'), - array('tour', 'tour-styling'), - ), - ); - - $libraries['tour-styling'] = array( - 'title' => 'Tour', - 'version' => \Drupal::VERSION, - 'css' => array( - $path . '/css/tour.module.css' => array('media' => 'screen'), - ), - ); - - $libraries['jquery.joyride'] = array( - 'title' => 'Joyride', - 'website' => 'https://github.com/zurb/joyride', - 'version' => '2.0.3', - 'js' => array( - $path . '/js/jquery.joyride-2.0.3.js' => array(), - ), - 'css' => array( - $path . '/css/joyride-2.0.3.css' => array('media' => 'screen'), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'jquery.cookie'), - ), - ); - - return $libraries; -} - -/** * Implements hook_toolbar(). */ function tour_toolbar() { diff --git a/core/modules/update/update.library.yml b/core/modules/update/update.library.yml new file mode 100644 index 0000000..10a9120 --- /dev/null +++ b/core/modules/update/update.library.yml @@ -0,0 +1,4 @@ +drupal.update.admin: + version: VERSION + css: + - { file: css/update.admin.css } diff --git a/core/modules/update/update.module b/core/modules/update/update.module index af8143b..4cf9c0d 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -145,23 +145,6 @@ 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(). */ function update_menu() { diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php index 38612a2..cfba21c 100644 --- a/core/modules/user/lib/Drupal/user/RegisterFormController.php +++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php @@ -36,7 +36,7 @@ public function form(array $form, array &$form_state) { return new RedirectResponse(url('user/' . $user->id(), array('absolute' => TRUE))); } - $form['#attached']['library'][] = array('system', 'jquery.cookie'); + $form['#attached']['library'][] = array('core', 'jquery.cookie'); $form['#attributes']['class'][] = 'user-info-from-cookie'; // Start with the default user account fields. diff --git a/core/modules/user/user.library.yml b/core/modules/user/user.library.yml new file mode 100644 index 0000000..9311d2a --- /dev/null +++ b/core/modules/user/user.library.yml @@ -0,0 +1,22 @@ +drupal.user: + version: VERSION + js: + - { file: user.js } + css: + - { file: css/user.module.css } + dependencies: + - core/jquery + - core/drupal + - core/jquery.once +drupal.user.permissions: + version: VERSION + js: + - { file: user.permissions.js } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings +drupal.user.icons: + version: VERSION + css: + - { file: css/user.icons.css } diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 6744e9e..31407f2 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1905,51 +1905,6 @@ function user_toolbar() { } /** - * Implements hook_library_info(). - */ -function user_library_info() { - $path = drupal_get_path('module', 'user'); - $libraries['drupal.user'] = array( - 'title' => 'User', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/user.js' => array(), - ), - 'css' => array( - $path . '/css/user.module.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - ), - ); - - $libraries['drupal.user.permissions'] = array( - 'title' => 'User permissions', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/user.permissions.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - ), - ); - - $libraries['drupal.user.icons'] = array( - 'title' => 'User icon styling', - 'version' => \Drupal::VERSION, - 'css' => array( - $path . '/css/user.icons.css' => array(), - ), - ); - - return $libraries; -} - -/** * Logs the current user out. */ function user_logout() { diff --git a/core/modules/views/views.library.yml b/core/modules/views/views.library.yml new file mode 100644 index 0000000..80467bf --- /dev/null +++ b/core/modules/views/views.library.yml @@ -0,0 +1,27 @@ +views.module: + version: VERSION + css: + - { file: css/views.module.css } +views.ajax: + version: VERSION + js: + - { file: js/base.js, group: 0 } + - { file: js/ajax_view.js, group: 0 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/jquery.form + - core/drupal.ajax +views.contextual-links: + version: VERSION + js: + - { file: js/views-contextual.js, group: -100, weight: -10 } + dependencies: + - core/jquery + - core/drupal +views.exposed-form: + version: VERSION + css: + - { file: css/views.exposed_form.css } diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 4ac7613..2772951 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -742,57 +742,6 @@ function views_hook_info() { } /** - * Implements hook_library_info(). - */ -function views_library_info() { - $path = drupal_get_path('module', 'views'); - $libraries['views.module'] = array( - 'title' => 'Views base', - 'version' => \Drupal::VERSION, - 'css' => array( - "$path/css/views.module.css" - ), - ); - $libraries['views.ajax'] = array( - 'title' => 'Views AJAX', - 'version' => \Drupal::VERSION, - 'js' => array( - "$path/js/base.js" => array('group' => JS_DEFAULT), - "$path/js/ajax_view.js" => array('group' => JS_DEFAULT), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - array('system', 'jquery.form'), - array('system', 'drupal.ajax'), - ), - ); - $libraries['views.contextual-links'] = array( - 'title' => 'Views Contextual links', - 'version' => \Drupal::VERSION, - 'js' => array( - // Set to -10 to move it before the contextual links javascript file. - "$path/js/views-contextual.js" => array('group' => JS_LIBRARY, 'weight' => -10), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - ), - ); - $libraries['views.exposed-form'] = array( - 'title' => 'Views exposed form', - 'version' => \Drupal::VERSION, - 'css' => array( - "$path/css/views.exposed_form.css", - ), - ); - - return $libraries; -} - -/** * Fetch a list of all base tables available * * @param $type diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 6c6cd0a..acfaabc 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -722,7 +722,7 @@ function template_preprocess_views_view_table(&$variables) { } if (!empty($options['sticky'])) { - $variables['view']->element['#attached']['library'][] = array('system', 'drupal.tableheader'); + $variables['view']->element['#attached']['library'][] = array('core', 'drupal.tableheader'); $variables['attributes']['class'][] = "sticky-enabled"; } $variables['attributes']['class'][] = 'cols-' . count($variables['header']); @@ -745,7 +745,7 @@ function template_preprocess_views_view_table(&$variables) { // with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM // and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors. if (isset($variables['header']) && $responsive) { - $variables['view']->element['#attached']['library'][] = array('system', 'drupal.tableresponsive'); + $variables['view']->element['#attached']['library'][] = array('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. $variables['attributes']['class'][] = 'responsive-enabled'; diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index 84df38e..1f50b93 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -82,10 +82,10 @@ public function form(array $form, array &$form_state) { $form['#tree'] = TRUE; - $form['#attached']['library'][] = array('system', 'jquery.ui.tabs'); - $form['#attached']['library'][] = array('system', 'jquery.ui.dialog'); - $form['#attached']['library'][] = array('system', 'drupal.states'); - $form['#attached']['library'][] = array('system', 'drupal.tabledrag'); + $form['#attached']['library'][] = array('core', 'jquery.ui.tabs'); + $form['#attached']['library'][] = array('core', 'jquery.ui.dialog'); + $form['#attached']['library'][] = array('core', 'drupal.states'); + $form['#attached']['library'][] = array('core', 'drupal.tabledrag'); if (!\Drupal::config('views.settings')->get('no_javascript')) { $form['#attached']['library'][] = array('views_ui', 'views_ui.admin'); diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php index ed9d983..2762bc2 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php @@ -176,7 +176,7 @@ public function render() { $list['#attributes']['id'] = 'views-entity-list'; $list['#attached']['css'] = ViewFormControllerBase::getAdminCSS(); - $list['#attached']['library'][] = array('system', 'drupal.ajax'); + $list['#attached']['library'][] = array('core', 'drupal.ajax'); $list['#attached']['library'][] = array('views_ui', 'views_ui.listing'); $form['filters'] = array( diff --git a/core/modules/views_ui/views_ui.library.yml b/core/modules/views_ui/views_ui.library.yml new file mode 100644 index 0000000..214e325 --- /dev/null +++ b/core/modules/views_ui/views_ui.library.yml @@ -0,0 +1,18 @@ +views_ui.admin: + version: VERSION + js: + - { file: js/ajax.js, group: 0 } + - { file: js/dialog.views.js, group: 0 } + - { file: js/views-admin.js, group: 0 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/jquery.form + - core/drupal.ajax + - views/views.ajax +views_ui.listing: + version: VERSION + js: + - { file: js/views_ui.listing.js, group: 0 } diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module index c175caa..ad712d9 100644 --- a/core/modules/views_ui/views_ui.module +++ b/core/modules/views_ui/views_ui.module @@ -129,44 +129,6 @@ function views_ui_permission() { } /** - * Implements hook_library_info(). - */ -function views_ui_library_info() { - $libraries = array(); - - $path = drupal_get_path('module', 'views_ui') . '/js/'; - - $libraries['views_ui.admin'] = array( - 'title' => 'Views UI ADMIN', - 'version' => \Drupal::VERSION, - 'js' => array( - $path . 'ajax.js' => array('group' => JS_DEFAULT), - $path . 'dialog.views.js' => array('group' => JS_DEFAULT), - $path . 'views-admin.js' => array('group' => JS_DEFAULT), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - array('system', 'jquery.form'), - array('system', 'drupal.ajax'), - array('views', 'views.ajax'), - ), - ); - - $libraries['views_ui.listing'] = array( - 'title' => 'Views UI listing', - 'version' => Drupal::VERSION, - 'js' => array( - $path . 'views_ui.listing.js' => array('group' => JS_DEFAULT), - ), - ); - - return $libraries; -} - -/** * Implements hook_preprocess_HOOK() for views templates. */ function views_ui_preprocess_views_view(&$variables) { @@ -331,30 +293,6 @@ function views_ui_contextual_links_suppress_pop() { } /** - * This is part of a patch to address a jQueryUI bug. The bug is responsible - * for the inability to scroll a page when a modal dialog is active. If the content - * of the dialog extends beyond the bottom of the viewport, the user is only able - * to scroll with a mousewheel or up/down keyboard keys. - * - * @see http://bugs.jqueryui.com/ticket/4671 - * @see https://bugs.webkit.org/show_bug.cgi?id=19033 - * @see /js/jquery.ui.dialog.patch.js - * @see /js/jquery.ui.dialog.min.js - * - * The javascript patch overwrites the $.ui.dialog.overlay.events object to remove - * the mousedown, mouseup and click events from the list of events that are bound - * in $.ui.dialog.overlay.create. - */ - -function views_ui_library_alter(&$libraries, $module) { - if ($module == 'system' && isset($libraries['jquery.ui.dialog'])) { - if (version_compare($libraries['jquery.ui.dialog']['version'], '1.7.2', '>=')) { - $libraries['jquery.ui.dialog']['js'][drupal_get_path('module', 'views') . '/js/jquery.ui.dialog.patch.js'] = array(); - } - } -} - -/** * Implements hook_views_analyze(). * * This is the basic views analysis that checks for very minimal problems. diff --git a/core/themes/bartik/bartik.library.yml b/core/themes/bartik/bartik.library.yml new file mode 100644 index 0000000..c20e1e1 --- /dev/null +++ b/core/themes/bartik/bartik.library.yml @@ -0,0 +1,4 @@ +maintenance_page: + version: VERSION + css: + - { file: css/maintenance-page.css, group: 100 } diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index e334125..b1e17bb 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -131,23 +131,6 @@ 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 templates. */ function bartik_preprocess_node(&$variables) { diff --git a/core/themes/seven/seven.library.yml b/core/themes/seven/seven.library.yml new file mode 100644 index 0000000..01c3763 --- /dev/null +++ b/core/themes/seven/seven.library.yml @@ -0,0 +1,6 @@ +install-page: + version: VERSION + js: + - { file: js/mobile.install.js, group: 100 } + css: + - { file: install-page.css, group: 100 } diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index 7defd49..234a26b 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -8,29 +8,6 @@ use Drupal\Core\Template\RenderWrapper; /** - * Implements hook_library_info(). - */ -function seven_library_info() { - $path = drupal_get_path('theme', 'seven'); - - $libraries['install-page'] = array( - 'version' => \Drupal::VERSION, - 'js' => array( - $path . '/js/mobile.install.js' => array( - 'group' => JS_THEME, - ), - ), - 'css' => array( - $path . '/install-page.css' => array( - 'group' => CSS_AGGREGATE_THEME, - ), - ), - ); - - return $libraries; -} - -/** * Implements hook_preprocess_HOOK() for HTML document templates. */ function seven_preprocess_html(&$variables) { @@ -179,7 +156,7 @@ function seven_menu_local_action($variables) { $libraries = array( '#attached' => array( 'library' => array( - array('system', 'modernizr'), + array('core', 'modernizr'), ), ), ); @@ -206,7 +183,7 @@ function seven_menu_local_action($variables) { function seven_element_info_alter(&$type) { // We require Modernizr for button styling. if (isset($type['button'])) { - $type['button']['#attached']['library'][] = array('system', 'modernizr'); + $type['button']['#attached']['library'][] = array('core', 'modernizr'); } }