diff --git a/core/core.libraries.yml b/core/core.libraries.yml new file mode 100644 index 0000000..5cd0004 --- /dev/null +++ b/core/core.libraries.yml @@ -0,0 +1,670 @@ +# All libraries are defined in alphabetical order. + +backbone: + remote: https://github.com/jashkenas/backbone + version: 1.1.0 + js: + assets/vendor/backbone/backbone.js: { weight: -19 } + dependencies: + - core/underscore + +classList: + remote: https://github.com/eligrey/classList.js + # @todo Stable release required for Drupal 8.0. + version: master + js: + assets/vendor/classList/classList.min.js: { weight: -21, browsers: { IE: 'lte IE 9', '!IE': false } } + +ckeditor: + remote: https://github.com/ckeditor/ckeditor-dev + # @todo Stable release required for Drupal 8.0. + version: 4.2-dev + commit: 887d81ac1824008b690e439a1b29eb4f13b51212 + js: + 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: + assets/vendor/domready/ready.min.js: { weight: -21 } + +drupal: + version: VERSION + js: + misc/drupal.js: { weight: -18 } + dependencies: + - core/domready + +drupalSettings: + version: VERSION + settings: {} + +drupal.active-link: + version: VERSION + js: + misc/active-link.js: {} + dependencies: + - core/drupal + - core/drupalSettings + - core/classList + +drupal.ajax: + version: VERSION + js: + misc/ajax.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.progress + - core/jquery.once + +drupal.announce: + version: VERSION + js: + misc/announce.js: {} + dependencies: + - core/drupal + - core/drupal.debounce + +drupal.autocomplete: + version: VERSION + js: + misc/autocomplete.js: { weight: -1 } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.ajax + - core/jquery.ui.autocomplete + +drupal.batch: + version: VERSION + js: + misc/batch.js: { cache: false } + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.ajax + - core/drupal.progress + - core/jquery.once + +drupal.collapse: + version: VERSION + js: + misc/collapse.js: {} + dependencies: + - core/jquery + - core/modernizr + - core/drupal + - core/drupal.form + - core/jquery.once + +drupal.debounce: + version: VERSION + js: + misc/debounce.js: {} + dependencies: + # @todo Remove Drupal dependency. + - core/drupal + +drupal.dialog: + version: VERSION + js: + misc/dialog.js: {} + misc/dialog.position.js: {} + css: + theme: + misc/dialog.theme.css: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.debounce + - core/drupal.displace + - core/jquery.ui.dialog + +drupal.dialog.ajax: + version: VERSION + js: + misc/dialog.ajax.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.ajax + - core/drupal.dialog + +drupal.displace: + version: VERSION + js: + misc/displace.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupal.debounce + +drupal.dropbutton: + version: VERSION + js: + misc/dropbutton/dropbutton.js: {} + css: + component: + misc/dropbutton/dropbutton.css: {} + theme: + misc/dropbutton/dropbutton.theme.css: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + +drupal.form: + version: VERSION + js: + misc/form.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.cookie + - core/jquery.once + +drupal.machine-name: + version: VERSION + js: + misc/machine-name.js: {} + dependencies: + - core/jquery + - core/jquery.once + - core/drupal + - core/drupalSettings + +drupal.progress: + version: VERSION + js: + misc/progress.js: {} + dependencies: + - core/drupal + - core/jquery + - core/drupalSettings + +drupal.states: + version: VERSION + js: + misc/states.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + +drupal.tabbingmanager: + version: VERSION + js: + misc/tabbingmanager.js: {} + dependencies: + - core/jquery + # Supplies the ':tabbable' pseudo selector. + - core/jquery.ui + - core/drupal + +drupal.tabledrag: + version: VERSION + js: + misc/tabledrag.js: { weight: -1 } + dependencies: + - core/jquery + - core/modernizr + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/jquery.cookie + +drupal.tableheader: + version: VERSION + js: + misc/tableheader.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/drupal.displace + +drupal.tableresponsive: + version: VERSION + js: + misc/tableresponsive.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + +drupal.tableselect: + version: VERSION + js: + misc/tableselect.js: {} + dependencies: + - core/drupal + - core/jquery + +drupal.timezone: + version: VERSION + js: + misc/timezone.js: {} + dependencies: + - core/jquery + - core/drupal + +drupal.vertical-tabs: + version: VERSION + js: + # Load before core/drupal.collapse. + misc/vertical-tabs.js: { weight: -1 } + css: + component: + 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: + assets/vendor/html5shiv/html5.js: { weight: -22, browsers: { IE: 'lte IE 8', '!IE': false } } + +jquery: + remote: https://github.com/jquery/jquery + version: 2.0.3 + js: + assets/vendor/jquery/jquery.js: { weight: -20 } + +jquery.cookie: + # @todo jquery.cookie.js was never supposed to be distributed with jQuery UI. + # @see https://drupal.org/node/2161217 + remote: https://github.com/carhartl/jquery-cookie + version: v1.0 + js: + 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: + assets/vendor/farbtastic/farbtastic.js: {} + css: + component: + assets/vendor/farbtastic/farbtastic.css: {} + dependencies: + - core/jquery + +jquery.form: + remote: https://github.com/malsup/form + version: 3.39 + js: + 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: + assets/vendor/jquery-once/jquery.once.js: { weight: -19 } + dependencies: + - core/jquery + +jquery.ui: + remote: https://github.com/jquery/jquery-ui + version: &jquery.ui 1.10.2 + js: + assets/vendor/jquery.ui/ui/jquery.ui.core.js: { weight: -11 } + css: + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.core.css: {} + theme: + assets/vendor/jquery.ui/themes/base/jquery.ui.theme.css: {} + dependencies: + - core/jquery + +jquery.ui.accordion: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.ui.accordion.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.autocomplete.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.button.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.datepicker.js: {} + css: + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.datepicker.css: {} + dependencies: + - core/jquery.ui + +jquery.ui.dialog: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.ui.dialog.js: {} + css: + component: + 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: + 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: + 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: + assets/vendor/jquery.ui/ui/jquery.effects.core.js: { weight: -9 } + +jquery.ui.effects.blind: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.blind.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.bounce: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.bounce.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.clip: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.clip.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.drop: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.drop.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.explode: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.explode.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.fade: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.fade.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.fold: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.fold.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.highlight: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.highlight.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.pulsate: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.pulsate.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.scale: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.scale.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.shake: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.shake.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.slide: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.slide.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.effects.transfer: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.effects.transfer.js: {} + dependencies: + - core/jquery.ui.effects.core + +jquery.ui.menu: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.ui.menu.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.mouse.js: {} + dependencies: + - core/jquery.ui.widget + +jquery.ui.position: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.ui.position.js: {} + +jquery.ui.progressbar: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.ui.progressbar.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.resizable.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.selectable.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.slider.js: {} + css: + component: + 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: + 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: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.tabs.js: {} + css: + component: + 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: + assets/vendor/jquery.ui/ui/jquery.ui.tooltip.js: {} + css: + component: + 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: + assets/vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js: {} + dependencies: + - core/jquery.ui + +jquery.ui.widget: + version: *jquery.ui + js: + assets/vendor/jquery.ui/ui/jquery.ui.widget.js: { weight: -10 } + dependencies: + - core/jquery.ui + +matchmedia: + remote: https://github.com/paulirish/matchMedia.js + # @todo Contribute upstream and replace with upstream version. + # @see http://drupal.org/node/1815602 + version: VERSION + js: + misc/matchmedia.js: {} + dependencies: + - core/drupal.debounce + +modernizr: + remote: https://github.com/Modernizr/Modernizr + version: v2.6.2 + js: + assets/vendor/modernizr/modernizr.min.js: { every_page: true, preprocess: 0, scope: header, weight: -21 } + +normalize: + remote: https://github.com/necolas/normalize.css + version: v2.1.2 + css: + base: + assets/vendor/normalize-css/normalize.css: { every_page: true, weight: -20 } + +underscore: + remote: https://github.com/jashkenas/underscore + version: 1.5.2 + js: + assets/vendor/underscore/underscore.js: { weight: -20 } + diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index de6f5d0..1ff3c2d 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 597ab43..72478b6 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -185,7 +185,7 @@ function _batch_progress_page() { ), ), 'library' => array( - array('system', 'drupal.batch'), + array('core', 'drupal.batch'), ), ), ); diff --git a/core/includes/common.inc b/core/includes/common.inc index a3b1910..72cca62 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; @@ -2665,7 +2666,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 @@ -2696,7 +2697,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,6 +2705,10 @@ function drupal_add_library($module, $name, $every_page = NULL) { // Only process the library if it exists and it was not added already. if (!isset($added[$module][$name])) { if ($library = drupal_get_library($module, $name)) { + // Allow modules and themes to dynamically attach request and context + // specific data for this library; e.g., localization. + drupal_alter('library', $library, $module, $name); + // Add all components within the library. $elements['#attached'] = array( 'library' => $library['dependencies'], @@ -2713,10 +2717,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; @@ -2748,62 +2748,170 @@ function drupal_add_library($module, $name, $every_page = NULL) { * - Two (or more) modules can still register the same library and use it * without conflicts in case the libraries are loaded on certain pages only. * - * @param $module - * The name of a module that registered a library. + * @param $extension + * The name of the extension that registered a library. * @param $name * (optional) The name of a registered library to retrieve. By default, all - * libraries registered by $module are returned. + * libraries registered by $extension are returned. * * @return * The definition of the requested library, if $name was passed and it exists, * or FALSE if it does not exist. If no $name was passed, an associative array - * of libraries registered by $module is returned (which may be empty). + * of libraries registered by $extension 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) { +function drupal_get_library($extension, $name = NULL) { $libraries = &drupal_static(__FUNCTION__, array()); - 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($libraries[$extension]) && ($cache = cache()->get('library:info:' . $extension))) { + $libraries[$extension] = $cache->data; + } + + if (!isset($libraries[$extension])) { + $libraries[$extension] = array(); + if ($extension === 'core') { + $path = 'core'; + $extension_type = 'core'; + } + else { + // @todo Add a $type argument OR automatically figure out the type based + // on current extension data, possibly using a module->theme fallback. + $path = drupal_get_path('module', $extension); + $extension_type = 'module'; + if (!$path) { + $path = drupal_get_path('theme', $extension); + $extension_type = 'theme'; + } + } + $library_file = DRUPAL_ROOT . '/' . $path . '/' . $extension . '.libraries.yml'; + + if ($library_file && file_exists($library_file)) { + $parser = new Parser(); + $libraries[$extension] = $parser->parse(file_get_contents($library_file)) ?: array(); + + // Allow modules to alter the module's registered libraries. + drupal_alter('library_info', $libraries[$extension], $extension); } - // 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; + + foreach ($libraries[$extension] 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) { + // Prepare (flatten) the SMACSS-categorized definitions. + // @todo After Asset(ic) changes, retain the definitions as-is and + // properly resolve dependencies for all (css) libraries per category, + // and only once prior to rendering out an HTML page. + if ($type == 'css' && !empty($library[$type])) { + foreach ($library[$type] as $category => $files) { + foreach ($files as $source => $options) { + if (!isset($options['weight'])) { + $options['weight'] = 0; + } + // Apply the corresponding weight defined by CSS_* constants. + $options['weight'] += constant('CSS_' . strtoupper($category == 'theme' ? 'skin' : $category)); + $library[$type][$source] = $options; + } + unset($library[$type][$category]); } - $module_libraries[$key]['js'][$file]['version'] = $module_libraries[$key]['version']; + } + foreach ($library[$type] as $source => $options) { + unset($library[$type][$source]); + // Allow to omit the options hashmap in YAML declarations. + if (!is_array($options)) { + $options = array(); + } + if ($type == 'js' && isset($options['weight']) && $options['weight'] > 0) { + throw new \UnexpectedValueException("The $extension/$id library defines a positive weight for '$source'. Only negative weights are allowed (but should be avoided). Instead of a positive weight, specify accurate dependencies for this library."); + } + // Unconditionally apply default groups for the defined asset files. + // The library system is a dependency management system. Each library + // properly specifies its dependencies instead of relying on a custom + // processing order. + if ($type == 'js') { + $options['group'] = JS_LIBRARY; + } + elseif ($type == 'css') { + $options['group'] = $extension_type == 'theme' ? CSS_AGGREGATE_THEME : CSS_AGGREGATE_DEFAULT; + } + // By default, all library assets are files. + if (!isset($options['type'])) { + $options['type'] = 'file'; + } + if ($options['type'] == 'external') { + $options['data'] = $source; + } + // Determine the file asset URI. + else { + if ($source[0] === '/') { + // An absolute path maps to DRUPAL_ROOT / base_path(). + if ($source[1] !== '/') { + $options['data'] = substr($source, 1); + } + // A protocol-free URI (e.g., //cdn.com/example.js) is external. + else { + $options['type'] = 'external'; + $options['data'] = $source; + } + } + // A stream wrapper URI (e.g., public://generated_js/example.js). + elseif (file_valid_uri($source)) { + $options['data'] = $source; + } + // By default, file paths are relative to the registering extension. + else { + $options['data'] = $path . '/' . $source; + } + } + $options['version'] = $library['version']; + + $library[$type][] = $options; + } + } + // @todo Introduce drupal_add_settings(). + if (isset($library['settings'])) { + $library['js'][] = array( + 'type' => 'setting', + 'data' => $library['settings'], + ); + unset($library['settings']); + } + // @todo Convert all uses of #attached[library][]=array('provider','name') + // into #attached[library][]='provider/name' and remove this. + foreach ($library['dependencies'] as $i => $dependency) { + if (!is_array($dependency)) { + $library['dependencies'][$i] = explode('/', $dependency, 2); } } } - $libraries[$module] = $module_libraries; + cache()->set('library:info:' . $extension, $libraries[$extension], CacheBackendInterface::CACHE_PERMANENT, array( + 'extension' => array(TRUE, $extension), + 'library_info' => array(TRUE), + )); } + if (isset($name)) { - if (!isset($libraries[$module][$name])) { - $libraries[$module][$name] = FALSE; + if (!isset($libraries[$extension][$name])) { + $libraries[$extension][$name] = FALSE; } - return $libraries[$module][$name]; + return $libraries[$extension][$name]; } - return $libraries[$module]; + return $libraries[$extension]; } /** @@ -2947,7 +3055,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'); } @@ -3595,7 +3703,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 5a46c8c..3de0c76 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -2082,7 +2082,7 @@ function install_configure_form($form, &$form_state, &$install_state) { $form['#attached']['library'][] = array('system', 'drupal.system'); // Add JavaScript time zone detection. - $form['#attached']['library'][] = array('system', 'drupal.timezone'); + $form['#attached']['library'][] = array('core', 'drupal.timezone'); // We add these strings as settings because JavaScript translation does not // work during installation. $js = array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail'))); diff --git a/core/includes/module.inc b/core/includes/module.inc index 429f5db..3d03b8e 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -5,6 +5,7 @@ * API for loading and interacting with Drupal modules. */ +use Drupal\Core\Cache\Cache; /** * Builds a list of bootstrap modules and enabled modules and themes. @@ -112,6 +113,13 @@ function system_list_reset() { drupal_static_reset('list_themes'); cache('bootstrap')->delete('system_list'); cache()->delete('system_info'); + + // Clear the library info cache. + // Libraries may be provided by all extension types, and may be altered by any + // other extensions (types) due to the nature of drupal_alter() and the fact + // that profiles are recorded and handled as modules. + Cache::invalidateTags(array('extension' => TRUE)); + // Remove last known theme data state. // This causes system_list() to call system_rebuild_theme_data() on its next // invocation. When enabling a module that implements hook_system_info_alter() diff --git a/core/includes/theme.inc b/core/includes/theme.inc index f7af433..b7d5518 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1583,7 +1583,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'; @@ -1592,7 +1592,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'; @@ -2183,7 +2183,7 @@ function template_preprocess_html(&$variables) { drupal_add_html_head($element, $name); } - drupal_add_library('system', 'html5shiv', TRUE); + drupal_add_library('core', 'html5shiv', TRUE); $variables['page_top'][] = array('#markup' => $page->getBodyTop()); $variables['page_bottom'][] = array('#markup' => $page->getBodyBottom()); @@ -2458,26 +2458,10 @@ function template_preprocess_maintenance_page(&$variables) { // These are usually added from system_page_build() except maintenance.css. // When the database is inactive it's not called so we add it here. - $default_css['library'][] = array('system', 'normalize'); - $path = drupal_get_path('module', 'system'); - // Adjust the weights to load these early. - $default_css['css'][$path . '/css/system.module.css'] = array( - 'weight' => CSS_COMPONENT - 10, - 'every_page' => TRUE, - ); - $default_css['css'][$path . '/css/system.theme.css'] = array( - 'weight' => CSS_SKIN - 10, - 'every_page' => TRUE, - ); - // Unlike regular pages, the admin.css is added for every maintenance page. - $default_css['css'][$path . '/css/system.admin.css'] = array( - 'weight' => CSS_COMPONENT - 10, - 'every_page' => TRUE, - ); - $default_css['css'][$path . '/css/system.maintenance.css'] = array( - 'weight' => CSS_COMPONENT - 10, - 'every_page' => TRUE, - ); + $default_css['library'][] = array('core', 'normalize'); + $default_css['library'][] = array('system', 'base'); + $default_css['library'][] = array('system', 'admin'); + $default_css['library'][] = array('system', 'maintenance'); $attached = array('#attached' => $default_css); drupal_render($attached); diff --git a/core/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/misc/batch.js b/core/misc/batch.js index b3013e5..ff24d7d 100644 --- a/core/misc/batch.js +++ b/core/misc/batch.js @@ -1,3 +1,6 @@ +/** + * Drupal's batch API. + */ (function ($, Drupal) { "use strict"; diff --git a/core/misc/displace.js b/core/misc/displace.js index c658694..4a9109b 100644 --- a/core/misc/displace.js +++ b/core/misc/displace.js @@ -1,5 +1,8 @@ /** * Manages elements that can offset the size of the viewport. + * + * Measures and reports viewport offset dimensions from elements like the + * toolbar that can potentially displace the positioning of other elements. */ (function ($, Drupal, debounce) { diff --git a/core/misc/drupal.js b/core/misc/drupal.js index e994ec6..957d69f 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -1,3 +1,6 @@ +/** + * Base framework for Drupal-specific JavaScript, behaviors, and settings. + */ window.Drupal = { behaviors: {}, locale: {} }; // Class indicating that JS is enabled; used for styling purpose. diff --git a/core/misc/states.js b/core/misc/states.js index 206d521..f2b68aa 100644 --- a/core/misc/states.js +++ b/core/misc/states.js @@ -1,3 +1,6 @@ +/** + * Drupal's states library. + */ (function ($) { "use strict"; diff --git a/core/modules/block/block.libraries.yml b/core/modules/block/block.libraries.yml new file mode 100644 index 0000000..20a5ce9 --- /dev/null +++ b/core/modules/block/block.libraries.yml @@ -0,0 +1,18 @@ +drupal.block: + version: VERSION + js: + block.js: {} + dependencies: + - core/jquery + - core/drupal + +drupal.block.admin: + version: VERSION + js: + js/block.admin.js: {} + css: + theme: + css/block.admin.css: {} + dependencies: + - core/jquery + - core/drupal diff --git a/core/modules/block/block.module b/core/modules/block/block.module index ae8ced6..cb6568a 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -575,36 +575,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 da7cbaa..a01765b 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -144,7 +144,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.libraries.yml b/core/modules/book/book.libraries.yml new file mode 100644 index 0000000..fe4209e --- /dev/null +++ b/core/modules/book/book.libraries.yml @@ -0,0 +1,8 @@ +drupal.book: + version: VERSION + js: + 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 9bc7b72..4cf85b1 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -822,23 +822,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.libraries.yml b/core/modules/ckeditor/ckeditor.libraries.yml new file mode 100644 index 0000000..13a175c --- /dev/null +++ b/core/modules/ckeditor/ckeditor.libraries.yml @@ -0,0 +1,65 @@ +drupal.ckeditor: + version: VERSION + js: + js/ckeditor.js: {} + css: + state: + css/ckeditor.css: {} + dependencies: + - core/jquery + - core/drupal + - core/drupal.debounce + - core/ckeditor + - editor/drupal.editor +drupal.ckeditor.admin: + version: VERSION + js: + js/ckeditor.admin.js: {} + css: + theme: + css/ckeditor.admin.css: {} + /core/assets/vendor/ckeditor/skins/moono/editor.css: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/jquery.ui.sortable + - core/jquery.ui.draggable + - core/jquery.ui.touch-punch + - core/backbone + - core/drupal.dialog + - core/drupal.announce + - core/ckeditor + - editor/drupal.editor.admin + # Ensure to run after core/drupal.vertical-tabs. + - core/drupal.vertical-tabs + +drupal.ckeditor.drupalimage.admin: + version: VERSION + js: + js/ckeditor.drupalimage.admin.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + - core/drupal.vertical-tabs + - core/drupalSettings + +drupal.ckeditor.stylescombo.admin: + version: VERSION + js: + js/ckeditor.stylescombo.admin.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + - core/drupal.vertical-tabs + - core/drupalSettings + +drupal.ckeditor.drupalimagecaption-theme: + version: VERSION + js: + js/plugins/drupalimagecaption/theme.js: {} + dependencies: + - core/ckeditor diff --git a/core/modules/ckeditor/ckeditor.module b/core/modules/ckeditor/ckeditor.module index 4214c20..d478aa8 100644 --- a/core/modules/ckeditor/ckeditor.module +++ b/core/modules/ckeditor/ckeditor.module @@ -32,108 +32,6 @@ function ckeditor_help($path, $arg) { } /** - * Implements hook_library_info(). - */ -function ckeditor_library_info() { - $module_path = drupal_get_path('module', 'ckeditor'); - - $libraries['drupal.ckeditor'] = array( - 'title' => 'Drupal behavior to enable CKEditor on textareas.', - 'version' => \Drupal::VERSION, - 'js' => array( - $module_path . '/js/ckeditor.js' => array(), - ), - 'css' => array( - $module_path . '/css/ckeditor.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupal.debounce'), - array('ckeditor', 'ckeditor'), - array('editor', 'drupal.editor'), - ), - ); - $libraries['drupal.ckeditor.admin'] = array( - 'title' => 'Drupal behavior for drag-and-drop CKEditor toolbar builder UI.', - 'version' => \Drupal::VERSION, - 'js' => array( - $module_path . '/js/ckeditor.admin.js' => array(), - ), - 'css' => array( - $module_path . '/css/ckeditor.admin.css' => array(), - 'core/assets/vendor/ckeditor/skins/moono/editor.css' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'jquery.once'), - array('system', 'jquery.ui.sortable'), - array('system', 'jquery.ui.draggable'), - array('system', 'jquery.ui.touch-punch'), - array('system', 'backbone'), - array('system', 'drupal.dialog'), - array('system', 'drupal.announce'), - array('ckeditor', 'ckeditor'), - array('editor', 'drupal.editor.admin'), - // Depend on Vertical Tabs, so that Vertical Tabs' JavaScript is executed - // first, which ensures its behavior runs first. - array('system', 'drupal.vertical-tabs'), - ), - ); - $libraries['drupal.ckeditor.drupalimage.admin'] = array( - 'title' => 'Only show the "drupalimage" plugin settings when its button is enabled.', - 'version' => \Drupal::VERSION, - 'js' => array( - $module_path . '/js/ckeditor.drupalimage.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - array('system', 'drupal.vertical-tabs'), - array('system', 'drupalSettings'), - ), - ); - $libraries['drupal.ckeditor.stylescombo.admin'] = array( - 'title' => 'Only show the "stylescombo" plugin settings when its button is enabled.', - 'version' => \Drupal::VERSION, - 'js' => array( - $module_path . '/js/ckeditor.stylescombo.admin.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupal'), - array('system', 'jquery.once'), - array('system', 'drupal.vertical-tabs'), - array('system', 'drupalSettings'), - ), - ); - $libraries['drupal.ckeditor.drupalimagecaption-theme'] = array( - 'title' => 'Theming support for the imagecaption plugin.', - 'version' => \Drupal::VERSION, - 'js' => array( - $module_path . '/js/plugins/drupalimagecaption/theme.js' => array(), - ), - 'dependencies' => array( - array('ckeditor', 'ckeditor'), - ), - ); - $libraries['ckeditor'] = array( - 'title' => 'Loads the main CKEditor library.', - 'version' => '4.3-dev — d8-imagecaption branch commit 887d81ac1824008b690e439a1b29eb4f13b51212', - 'js' => array( - 'core/assets/vendor/ckeditor/ckeditor.js' => array( - 'preprocess' => FALSE, - ), - ), - ); - - return $libraries; -} - -/** * Implements hook_theme(). */ 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.libraries.yml b/core/modules/color/color.libraries.yml new file mode 100644 index 0000000..c6a2db9 --- /dev/null +++ b/core/modules/color/color.libraries.yml @@ -0,0 +1,20 @@ +drupal.color: + version: VERSION + js: + color.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + - core/jquery.farbtastic + - color/drupal.color.preview + +drupal.color.preview: + version: VERSION + js: + preview.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once 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.libraries.yml b/core/modules/comment/comment.libraries.yml new file mode 100644 index 0000000..b4cd2a4 --- /dev/null +++ b/core/modules/comment/comment.libraries.yml @@ -0,0 +1,36 @@ +drupal.comment: + version: VERSION + js: + comment-entity-form.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupal.form + +drupal.comment-by-viewer: + version: VERSION + js: + js/comment-by-viewer.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + +drupal.comment-new-indicator: + version: VERSION + js: + js/comment-new-indicator.js: {} + dependencies: + - core/jquery + - core/drupal + - history/drupal.history + - core/drupal.displace + +drupal.node-new-comments-link: + version: VERSION + js: + js/node-new-comments-link.js: {} + dependencies: + - core/jquery + - core/drupal + - history/drupal.history diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 4c60499..7d0eb0b 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1627,60 +1627,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 0adb4fc..b9d1a80 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 8e95d7e..aa9c7ba 100644 --- a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php @@ -171,7 +171,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 ($storage_comparer->getChangelist() as $config_change_type => $config_files) { if (empty($config_files)) { diff --git a/core/modules/config_translation/config_translation.libraries.yml b/core/modules/config_translation/config_translation.libraries.yml new file mode 100644 index 0000000..5e31768 --- /dev/null +++ b/core/modules/config_translation/config_translation.libraries.yml @@ -0,0 +1,5 @@ +drupal.config_translation.admin: + version: VERSION + css: + theme: + css/config_translation.admin.css: {} diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index da89447..b962266 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -190,16 +190,3 @@ function config_translation_config_translation_type_info_alter(&$definitions) { $definitions['date_format']['form_element_class'] = '\Drupal\config_translation\FormElement\DateFormat'; } -/** - * 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; -} 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.libraries.yml b/core/modules/content_translation/content_translation.libraries.yml new file mode 100644 index 0000000..3dd1ce0 --- /dev/null +++ b/core/modules/content_translation/content_translation.libraries.yml @@ -0,0 +1,11 @@ +drupal.content_translation.admin: + version: VERSION + js: + content_translation.admin.js: {} + css: + theme: + 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 1f7afb5..4f2631c 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -418,30 +418,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.libraries.yml b/core/modules/contextual/contextual.libraries.yml new file mode 100644 index 0000000..05b2f1a --- /dev/null +++ b/core/modules/contextual/contextual.libraries.yml @@ -0,0 +1,41 @@ +drupal.contextual-links: + version: VERSION + js: + # Ensure to run before contextual/drupal.context-toolbar. + # Core. + js/contextual.js: { weight: -2 } + # Models. + js/models/StateModel.js: { weight: -2 } + # Views. + js/views/AuralView.js: { weight: -2 } + js/views/KeyboardView.js: { weight: -2 } + js/views/RegionView.js: { weight: -2 } + js/views/VisualView.js: { weight: -2 } + css: + component: + css/contextual.module.css: {} + theme: + css/contextual.theme.css: {} + css/contextual.icons.css: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/backbone + - core/modernizr + - core/jquery.once + +drupal.contextual-toolbar: + version: VERSION + js: + js/contextual.toolbar.js: {} + css: + component: + 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 3fd2cb9..a998e74 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module @@ -90,68 +90,6 @@ function contextual_permission() { } /** - * Implements hook_library_info(). - */ -function contextual_library_info() { - $path = drupal_get_path('module', 'contextual'); - // Add the JavaScript, with a group and weight such that it will run - // before core/modules/contextual/js/contextual.toolbar.js. - $options = array( - 'group' => JS_LIBRARY, - 'weight' => -2, - ); - $libraries['drupal.contextual-links'] = array( - 'title' => 'Contextual Links', - 'website' => 'http://drupal.org/node/473268', - 'version' => \Drupal::VERSION, - 'js' => array( - // Core. - $path . '/js/contextual.js' => $options, - // Models. - $path . '/js/models/StateModel.js' => $options, - // Views. - $path . '/js/views/AuralView.js' => $options, - $path . '/js/views/KeyboardView.js' => $options, - $path . '/js/views/RegionView.js' => $options, - $path . '/js/views/VisualView.js' => $options, - ), - '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.libraries.yml b/core/modules/edit/edit.libraries.yml new file mode 100644 index 0000000..053eeb0 --- /dev/null +++ b/core/modules/edit/edit.libraries.yml @@ -0,0 +1,55 @@ +edit: + version: VERSION + js: + # Core. + js/edit.js: { scope: footer } + js/util.js: { scope: footer } + # Models. + js/models/BaseModel.js: { scope: footer } + js/models/AppModel.js: { scope: footer } + js/models/EntityModel.js: { scope: footer } + js/models/FieldModel.js: { scope: footer } + js/models/EditorModel.js: { scope: footer } + # Views. + js/views/AppView.js: { scope: footer } + js/views/FieldDecorationView.js: { scope: footer } + js/views/EntityDecorationView.js: { scope: footer } + js/views/EntityToolbarView.js: { scope: footer } + js/views/ContextualLinkView.js: { scope: footer } + js/views/FieldToolbarView.js: { scope: footer } + js/views/EditorView.js: { scope: footer } + # Other. + js/theme.js: { scope: footer } + css: + component: + css/edit.module.css: {} + theme: + css/edit.theme.css: {} + 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: + js/editors/formEditor.js: { scope: footer } + dependencies: + - edit/edit + +edit.inPlaceEditor.plainText: + version: VERSION + js: + js/editors/plainTextEditor.js: { scope: footer } + dependencies: + - edit/edit diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module index 3eaabcc..5cfe310 100644 --- a/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -46,93 +46,52 @@ 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/BaseModel.js' => $options, - $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(). + * Implements hook_library_alter(). + * + * Includes additional stylesheets defined by the admin theme to allow it to + * customize the Edit toolbar appearance. + * + * An admin theme can specify CSS files to make the front-end administration + * experience of in-place editing match the administration experience in the + * back-end. + * + * The CSS files can be specified via the "edit_stylesheets" property in the + * .info.yml file: + * @code + * edit_stylesheets: + * - css/edit.css + * @endcode + * + * The library needs to be dynamically enhanced, because an admin theme normally + * does not participate in the front-end. + * + * @param string $theme + * (optional) Internal use only. A base theme name for which to retrieve the + * 'edit_stylesheets' property. * - * Allow the admin theme to override the Edit entity toolbar's default styling. - * We must do it this way, because an admin theme's hooks do not fire while on - * the front-end. + * @todo Remove this in favor of the 'stylesheets-additional' property proposed + * in https://drupal.org/node/1209958 */ -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(); +function edit_library_alter(array &$library, $extension, $name, $theme = NULL) { + if ($extension == 'edit' && $name == 'edit') { + // Retrieve the admin theme. + if (!isset($theme)) { + $theme = Drupal::config('system.theme')->get('admin'); + } + if ($theme && $theme_path = drupal_get_path('theme', $theme)) { + $info = system_get_info('theme', $theme); + // Recurse to process base theme(s) first. + if (isset($info['base theme'])) { + edit_library_alter($library, $extension, $name, $info['base theme']); + } + if (isset($info['edit_stylesheets']) && is_array($info['edit_stylesheets'])) { + foreach ($info['edit_stylesheets'] as $path) { + $library['css'][$theme_path . '/' . $path] = array( + 'group' => CSS_AGGREGATE_THEME, + 'weight' => CSS_SKIN, + ); + } + } } } } @@ -185,41 +144,3 @@ function edit_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisp $build['#attributes']['data-edit-entity-id'] = $entity->entityType() . '/' . $entity->id(); } -/** - * Retrieves the admin theme's Edit stylesheets. - * - * Admin themes may specify CSS files to make the front-end administration - * experience of in-place editing match the administration experience on the - * Drupal back-end. - * They can specify such CSS files using the "edit_stylesheets" key in - * the theme .info.yml file. - * - * @code - * edit_stylesheets[] = css/edit.css - * @endcode - * - * @param string|NULL $theme - * The theme name for which to retrieve the edit_stylesheets CSS files. - * - * @return array - * An array of CSS file paths. - */ -function _edit_theme_css($theme = NULL) { - $css = array(); - if (!isset($theme)) { - $theme = Drupal::config('system.theme')->get('admin'); - } - if ($theme_path = drupal_get_path('theme', $theme)) { - $info = system_get_info('theme', $theme); - if (isset($info['edit_stylesheets'])) { - $css = $info['edit_stylesheets']; - foreach ($css as $key => $path) { - $css[$key] = $theme_path . '/' . $path; - } - } - if (isset($info['base theme'])) { - $css = array_merge(_edit_theme_css($info['base theme'], $css)); - } - } - return $css; -} diff --git a/core/modules/editor/editor.api.php b/core/modules/editor/editor.api.php index fe9548b..cc03cdb 100644 --- a/core/modules/editor/editor.api.php +++ b/core/modules/editor/editor.api.php @@ -93,13 +93,11 @@ function hook_editor_default_settings_alter(&$default_settings, $editor) { * @param array $settings * All the settings that will be added to the page via _drupal_add_js() for * the text formats to which a user has access. - * @param array $formats - * The list of format objects for which settings are being added. */ -function hook_editor_js_settings_alter(array &$settings, array $formats) { - if (isset($formats['basic_html'])) { - $settings['basic_html']['editor'][] = 'MyDifferentEditor'; - $settings['basic_html']['editorSettings']['buttons'] = array('strong', 'italic', 'underline'); +function hook_editor_js_settings_alter(array &$settings) { + if (isset($settings['editor']['formats']['basic_html'])) { + $settings['editor']['formats']['basic_html']['editor'] = 'MyDifferentEditor'; + $settings['editor']['formats']['basic_html']['editorSettings']['buttons'] = array('strong', 'italic', 'underline'); } } diff --git a/core/modules/editor/editor.libraries.yml b/core/modules/editor/editor.libraries.yml new file mode 100644 index 0000000..2504458 --- /dev/null +++ b/core/modules/editor/editor.libraries.yml @@ -0,0 +1,40 @@ +drupal.editor.admin: + version: VERSION + js: + js/editor.admin.js: {} + dependencies: + - core/jquery + - core/drupal + +drupal.editor: + version: VERSION + js: + js/editor.js: {} + css: + component: + css/editor.css: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + +drupal.editor.dialog: + version: VERSION + js: + js/editor.dialog.js: {} + dependencies: + - core/jquery + - core/drupal.dialog + - core/drupal.ajax + - core/drupalSettings + +edit.inPlaceEditor.formattedText: + version: VERSION + js: + js/editor.formattedTextEditor.js: { scope: footer, attributes: { defer: true } } + 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 3d9ec7c..37caff0 100644 --- a/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -71,74 +71,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), - ), - ), - '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/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php index fcc2076..3114e3a 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php @@ -76,15 +76,15 @@ public function getAttachments(array $format_ids) { // Libraries. $attachments['library'] = array_merge($attachments['library'], $plugin->getLibraries($editor)); - // JavaScript settings. - $settings[$format_id] = array( + // Format-specific JavaScript settings. + $settings['editor']['formats'][$format_id] = array( 'format' => $format_id, 'editor' => $editor->editor, 'editorSettings' => $plugin->getJSSettings($editor), ); } - // We have all JavaScript settings, allow other modules to alter them. + // Allow other modules to alter all JavaScript settings. drupal_alter('editor_js_settings', $settings); if (empty($attachments['library']) && empty($settings)) { @@ -93,7 +93,7 @@ public function getAttachments(array $format_ids) { $attachments['js'][] = array( 'type' => 'setting', - 'data' => array('editor' => array('formats' => $settings)), + 'data' => $settings, ); return $attachments; diff --git a/core/modules/editor/tests/modules/editor_test.module b/core/modules/editor/tests/modules/editor_test.module index fc2d748..6a0a30f 100644 --- a/core/modules/editor/tests/modules/editor_test.module +++ b/core/modules/editor/tests/modules/editor_test.module @@ -35,7 +35,7 @@ function editor_test_editor_js_settings_alter(&$settings) { return; } - if (isset($settings['full_html'])) { - $settings['full_html']['editorSettings']['ponyModeEnabled'] = FALSE; + if (isset($settings['editor']['formats']['full_html'])) { + $settings['editor']['formats']['full_html']['editorSettings']['ponyModeEnabled'] = FALSE; } } diff --git a/core/modules/field_ui/field_ui.libraries.yml b/core/modules/field_ui/field_ui.libraries.yml new file mode 100644 index 0000000..4add558 --- /dev/null +++ b/core/modules/field_ui/field_ui.libraries.yml @@ -0,0 +1,12 @@ +drupal.field_ui: + version: VERSION + js: + field_ui.js: {} + css: + theme: + 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 b8b2e12..a2f5dfb 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -224,30 +224,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.libraries.yml b/core/modules/file/file.libraries.yml new file mode 100644 index 0000000..1cb5e06 --- /dev/null +++ b/core/modules/file/file.libraries.yml @@ -0,0 +1,11 @@ +drupal.file: + version: VERSION + js: + file.js: {} + css: + theme: + 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 892b214..8e33030 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1933,29 +1933,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.libraries.yml b/core/modules/filter/filter.libraries.yml new file mode 100644 index 0000000..91aea0b --- /dev/null +++ b/core/modules/filter/filter.libraries.yml @@ -0,0 +1,40 @@ +drupal.filter.admin: + version: VERSION + js: + filter.admin.js: {} + css: + theme: + css/filter.admin.css: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + - core/drupal.form + +drupal.filter.filter_html.admin: + version: VERSION + js: + filter.filter_html.admin.js: {} + dependencies: + - core/jquery + - core/jquery.once + - core/underscore + +drupal.filter: + version: VERSION + js: + filter.js: {} + css: + theme: + # @todo Misnomer: Does not contain administrative styles. + css/filter.admin.css: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + +caption: + version: VERSION + css: + component: + css/filter.caption.css: {} diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 7a752d2..1ce51bb 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -1459,63 +1459,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.libraries.yml b/core/modules/forum/forum.libraries.yml new file mode 100644 index 0000000..28ceda3 --- /dev/null +++ b/core/modules/forum/forum.libraries.yml @@ -0,0 +1,5 @@ +forum.index: + version: VERSION + css: + component: + css/forum.module.css: {} diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 679b52a..ee21e5e 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -893,20 +893,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.libraries.yml b/core/modules/history/history.libraries.yml new file mode 100644 index 0000000..4920096 --- /dev/null +++ b/core/modules/history/history.libraries.yml @@ -0,0 +1,9 @@ +drupal.history: + version: VERSION + js: + 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 cf9278b..154be72 100644 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -184,27 +184,6 @@ function history_user_delete($account) { } /** - * 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; -} - -/** * #post_render_cache callback; attaches the last read timestamp for a node. * * @param array $element diff --git a/core/modules/language/language.libraries.yml b/core/modules/language/language.libraries.yml new file mode 100644 index 0000000..78491b3 --- /dev/null +++ b/core/modules/language/language.libraries.yml @@ -0,0 +1,8 @@ +language.admin: + version: VERSION + js: + 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 3794409..d725dc4 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -554,26 +554,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.libraries.yml b/core/modules/locale/locale.libraries.yml new file mode 100644 index 0000000..230f182 --- /dev/null +++ b/core/modules/locale/locale.libraries.yml @@ -0,0 +1,17 @@ +drupal.locale.admin: + version: VERSION + js: + locale.admin.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + +drupal.locale.datepicker: + version: VERSION + js: + 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 8605e27..4ec49f5 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -655,61 +655,24 @@ 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(). + * Implements hook_library_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'])) { - $language_interface = language(Language::TYPE_INTERFACE); +function locale_library_alter(array &$library, $module, $name) { + if ($module == 'core' && $name == 'jquery.ui.datepicker') { // 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 - // hook_library_info_alter(), thus does not have to be specified explicitly. - $libraries['jquery.ui.datepicker']['dependencies'][] = array('locale', 'drupal.locale.datepicker'); - $libraries['jquery.ui.datepicker']['js'][] = array( - 'data' => array( - 'jquery' => array( - 'ui' => array( - 'datepicker' => array( - 'isRTL' => $language_interface->direction == Language::DIRECTION_RTL, - 'firstDay' => \Drupal::config('system.date')->get('first_day'), - ), - ), - ), - ), + // the behavior executes early. JS_LIBRARY is the default. + $library['dependencies'][] = array('locale', 'drupal.locale.datepicker'); + + $language_interface = language(Language::TYPE_INTERFACE); + $settings['jquery']['ui']['datepicker'] = array( + 'isRTL' => $language_interface->direction == Language::DIRECTION_RTL, + 'firstDay' => \Drupal::config('system.date')->get('first_day'), + ); + $library['js'][] = array( 'type' => 'setting', + 'data' => $settings, ); } } diff --git a/core/modules/menu/menu.libraries.yml b/core/modules/menu/menu.libraries.yml new file mode 100644 index 0000000..56cf437 --- /dev/null +++ b/core/modules/menu/menu.libraries.yml @@ -0,0 +1,16 @@ +drupal.menu: + version: VERSION + js: + menu.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupal.form + +drupal.menu.admin: + version: VERSION + js: + menu.admin.js: {} + dependencies: + - core/jquery + - core/drupal diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index d4a8857..13ddec5 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -693,34 +693,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.libraries.yml b/core/modules/node/node.libraries.yml new file mode 100644 index 0000000..28131b5 --- /dev/null +++ b/core/modules/node/node.libraries.yml @@ -0,0 +1,26 @@ +drupal.node: + version: VERSION + js: + node.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/drupal.form + +drupal.node.preview: + version: VERSION + js: + node.preview.js: {} + dependencies: + - core/jquery + - core/drupal + +drupal.content_types: + version: VERSION + js: + 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 ec0cd7c..98b7722 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1889,50 +1889,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.libraries.yml b/core/modules/path/path.libraries.yml new file mode 100644 index 0000000..2ce29a5 --- /dev/null +++ b/core/modules/path/path.libraries.yml @@ -0,0 +1,8 @@ +drupal.path: + version: VERSION + js: + 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 80eeace..f160d66 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -280,23 +280,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.libraries.yml b/core/modules/picture/picture.libraries.yml new file mode 100644 index 0000000..695fae7 --- /dev/null +++ b/core/modules/picture/picture.libraries.yml @@ -0,0 +1,10 @@ +# @todo Move into /core/assets and core.library.yml. +picturefill: + remote: https://github.com/scottjehl/picturefill + # @todo Contribute upstream and/or replace with upstream version. + # @see https://drupal.org/node/1775530 + version: VERSION + js: + picturefill/picturefill.js: { weight: -10 } + dependencies: + - core/matchmedia diff --git a/core/modules/picture/picture.module b/core/modules/picture/picture.module index cd7e4e6..e662ce3 100644 --- a/core/modules/picture/picture.module +++ b/core/modules/picture/picture.module @@ -87,24 +87,6 @@ function picture_menu_link_defaults() { } /** - * 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.libraries.yml b/core/modules/shortcut/shortcut.libraries.yml new file mode 100644 index 0000000..94bad9d --- /dev/null +++ b/core/modules/shortcut/shortcut.libraries.yml @@ -0,0 +1,16 @@ +drupal.shortcut.admin: + version: VERSION + js: + shortcut.admin.js: {} + dependencies: + - core/jquery + - core/drupal + +drupal.shortcut: + version: VERSION + css: + component: + css/shortcut.module.css: {} + theme: + css/shortcut.theme.css: {} + css/shortcut.icons.css: {} diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index a988cf4..9ea15b5 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -489,32 +489,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.libraries.yml b/core/modules/simpletest/simpletest.libraries.yml new file mode 100644 index 0000000..7bcbc07 --- /dev/null +++ b/core/modules/simpletest/simpletest.libraries.yml @@ -0,0 +1,14 @@ +drupal.simpletest: + version: VERSION + js: + simpletest.js: {} + css: + component: + 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 6efecef..35e60f8 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -713,32 +713,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.libraries.yml b/core/modules/statistics/statistics.libraries.yml new file mode 100644 index 0000000..2fbe5c0 --- /dev/null +++ b/core/modules/statistics/statistics.libraries.yml @@ -0,0 +1,8 @@ +drupal.statistics: + version: VERSION + js: + 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 7100fc0..0353e25 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -265,28 +265,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 565e35e..3cd5e57 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php @@ -80,7 +80,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['path']), 'The current path JavaScript setting is set correctly.'); @@ -106,7 +106,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(); @@ -127,7 +127,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(); @@ -143,7 +143,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.'); @@ -205,7 +205,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.'); @@ -215,7 +215,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.'); @@ -227,7 +227,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(); @@ -239,7 +239,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'); @@ -250,7 +250,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.'); } @@ -259,7 +259,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.'); } @@ -280,7 +280,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(); @@ -296,7 +296,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(); @@ -313,7 +313,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'); @@ -333,7 +333,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'); @@ -356,7 +356,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'); @@ -377,7 +377,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'); @@ -448,7 +448,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.'); @@ -475,18 +475,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.'); } /** @@ -496,11 +490,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.'); } @@ -508,11 +502,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.'); } /** @@ -533,7 +527,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.'); @@ -546,14 +540,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( @@ -682,8 +682,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( @@ -700,7 +700,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 ed33a05..b8f4092 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,24 +292,75 @@ 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['jquery.farbtastic'])) { // Verify existing version is older than the one we are updating to. - if (version_compare($libraries['farbtastic']['version'], '2.0', '<')) { + if (version_compare($libraries['jquery.farbtastic']['version'], '2.0', '<')) { // Update the existing Farbtastic to version 2.0. - $libraries['farbtastic']['version'] = '2.0'; - $libraries['farbtastic']['js'] = array( - drupal_get_path('module', 'farbtastic_update') . '/farbtastic-2.0.js' => array(), + $libraries['jquery.farbtastic']['version'] = '2.0'; + // To accurately replace library files, the order of files and the options + // of each file have to be retained; e.g., like this: + $old_path = 'assets/vendor/farbtastic'; + // Since the replaced library files are no longer located in a directory + // relative to the original extension, specify an absolute path (relative + // to DRUPAL_ROOT / base_path()) to the new location. + $new_path = '/' . drupal_get_path('module', 'farbtastic_update') . '/js'; + $new_js = array(); + $replacements = array( + $old_path . '/farbtastic.js' => $new_path . '/farbtastic-2.0.js', ); + foreach ($libraries['jquery.farbtastic']['js'] as $source => $options) { + if (isset($replacements[$source])) { + $new_js[$replacements[$source]] = $options; + } + else { + $new_js[$source] = $options; + } + } + $libraries['jquery.farbtastic']['js'] = $new_js; } } } /** + * Alters a JavaScript/CSS library before it is attached. + * + * Allows modules and themes to dynamically attach further assets to a library + * when it is added to the page; e.g., to add JavaScript settings. + * + * This hook is only invoked once per library and page. + * + * @param array $library + * The JavaScript/CSS library that is being added. + * @param string $extension + * The name of the extension that registered the library. + * @param string $name + * The name of the library. + * + * @see drupal_add_library() + */ +function hook_library_alter(array &$library, $extension, $name) { + if ($extension == 'core' && $name == 'jquery.ui.datepicker') { + // Note: If the added assets do not depend on additional request-specific + // data supplied here, consider to statically register it directly via + // hook_library_info_alter() already. + $library['dependencies'][] = array('locale', 'drupal.locale.datepicker'); + + $language_interface = language(Language::TYPE_INTERFACE); + $settings['jquery']['ui']['datepicker'] = array( + 'isRTL' => $language_interface->direction == Language::DIRECTION_RTL, + 'firstDay' => \Drupal::config('system.date')->get('first_day'), + ); + $library['js'][] = array( + 'type' => 'setting', + 'data' => $settings, + ); + } +} + +/** * Alter CSS files before they are output on the page. * * @param $css diff --git a/core/modules/system/system.libraries.yml b/core/modules/system/system.libraries.yml new file mode 100644 index 0000000..61eb1b4 --- /dev/null +++ b/core/modules/system/system.libraries.yml @@ -0,0 +1,46 @@ +base: + version: VERSION + css: + # Adjust the weights to load these early. + component: + css/system.module.css: { every_page: true, weight: -10, } + theme: + css/system.theme.css: { every_page: true, weight: -10 } + dependencies: + - core/normalize + +admin: + version: VERSION + css: + theme: + css/system.admin.css: { weight: -10 } + dependencies: + - system/base + +maintenance: + version: VERSION + css: + theme: + css/system.maintenance.css: { weight: -10 } + dependencies: + - system/base + - system/admin + +drupal.system: + version: VERSION + js: + system.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + +drupal.system.modules: + version: VERSION + js: + 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 ed0efba..12f0514 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1066,1036 +1066,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 active link marking. - $libraries['drupal.active-link'] = array( - 'title' => 'Drupal active link marking', - 'version' => \Drupal::VERSION, - 'js' => array( - 'core/misc/active-link.js' => array(), - ), - 'dependencies' => array( - array('system', 'drupal'), - array('system', 'drupalSettings'), - array('system', 'classList'), - ), - ); - - // 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', 'drupal.debounce'), - 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), - ), - ); - - // IE9 classList polyfill. - $libraries['classList'] = array( - 'title' => 'classList.js', - 'website' => 'https://github.com/eligrey/classList.js', - 'version' => 'master', - 'js' => array( - 'core/assets/vendor/classList/classList.min.js' => array( - 'group' => JS_LIBRARY, - 'weight' => -21, - 'browsers' => array('IE' => 'lte IE 9', '!IE' => FALSE), - ), - ), - ); - - // 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.5.2', - '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' => '1.1.0', - '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() { @@ -2335,21 +1305,10 @@ 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'); - $path = drupal_get_path('module', 'system'); - // Adjust the weights to load these early. - $page['#attached']['css'][$path . '/css/system.module.css'] = array( - 'weight' => CSS_COMPONENT - 10, - 'every_page' => TRUE, - ); - $page['#attached']['css'][$path . '/css/system.theme.css'] = array( - 'weight' => CSS_SKIN - 10, - 'every_page' => TRUE, - ); + $page['#attached']['library'][] = array('core', 'normalize'); + $page['#attached']['library'][] = array('system', 'base'); if (path_is_admin(current_path())) { - $page['#attached']['css'][$path . '/css/system.admin.css'] = array( - 'weight' => CSS_COMPONENT - 10, - ); + $page['#attached']['library'][] = array('system', 'admin'); } // Handle setting the "active" class on links by: @@ -2360,7 +1319,7 @@ function system_page_build(&$page) { // @see theme_links() // @see \Drupal\system\Controller\SystemController::setLinkActiveClass if (\Drupal::currentUser()->isAuthenticated()) { - $page['#attached']['library'][] = array('system', 'drupal.active-link'); + $page['#attached']['library'][] = array('core', 'drupal.active-link'); } else { $page['#post_render_cache']['\Drupal\system\Controller\SystemController::setLinkActiveClass'] = array( @@ -2437,7 +1396,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.libraries.yml b/core/modules/system/tests/modules/common_test/common_test.libraries.yml new file mode 100644 index 0000000..47d2b37 --- /dev/null +++ b/core/modules/system/tests/modules/common_test/common_test.libraries.yml @@ -0,0 +1,9 @@ +jquery.farbtastic: + version: 0.1 + js: + assets/vendor/farbtastic/farbtastic.js: {} + css: + component: + 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.libraries.yml b/core/modules/taxonomy/taxonomy.libraries.yml new file mode 100644 index 0000000..7d6f50d --- /dev/null +++ b/core/modules/taxonomy/taxonomy.libraries.yml @@ -0,0 +1,12 @@ +drupal.taxonomy: + version: VERSION + js: + taxonomy.js: {} + css: + component: + 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 3d19993..e945658 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -958,27 +958,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.libraries.yml b/core/modules/text/text.libraries.yml new file mode 100644 index 0000000..8e82411 --- /dev/null +++ b/core/modules/text/text.libraries.yml @@ -0,0 +1,8 @@ +drupal.text: + version: VERSION + js: + 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.libraries.yml b/core/modules/toolbar/toolbar.libraries.yml new file mode 100644 index 0000000..d58522e --- /dev/null +++ b/core/modules/toolbar/toolbar.libraries.yml @@ -0,0 +1,52 @@ +toolbar: + version: VERSION + js: + # Core. + js/toolbar.js: {} + # Models. + js/models/MenuModel.js: {} + js/models/ToolbarModel.js: {} + # Views. + js/views/BodyVisualView.js: {} + js/views/MenuVisualView.js: {} + js/views/ToolbarAuralView.js: {} + js/views/ToolbarVisualView.js: {} + css: + component: + css/toolbar.module.css: {} + theme: + css/toolbar.theme.css: {} + 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: + js/toolbar.menu.js: {} + css: + state: + css/toolbar.menu.css: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + +toolbar.escapeAdmin: + version: VERSION + js: + 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 bcb8954..935708c 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -497,77 +497,6 @@ function toolbar_get_rendered_subtrees() { } /** - * Implements hook_library_info(). - */ -function toolbar_library_info() { - $path = drupal_get_path('module', 'toolbar'); - $libraries['toolbar'] = array( - 'title' => 'Toolbar', - 'version' => \Drupal::VERSION, - 'js' => array( - // Core. - $path . '/js/toolbar.js' => array(), - // Models. - $path . '/js/models/MenuModel.js' => array(), - $path . '/js/models/ToolbarModel.js' => array(), - // Views. - $path . '/js/views/BodyVisualView.js' => array(), - $path . '/js/views/MenuVisualView.js' => array(), - $path . '/js/views/ToolbarAuralView.js' => array(), - $path . '/js/views/ToolbarVisualView.js' => array(), - ), - 'css' => array( - $path . '/css/toolbar.module.css', - $path . '/css/toolbar.theme.css', - $path . '/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( - $path . '/js/toolbar.menu.js' => array(), - ), - 'css' => array( - $path . '/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( - $path . '/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.libraries.yml b/core/modules/tour/tour.libraries.yml new file mode 100644 index 0000000..92dd861 --- /dev/null +++ b/core/modules/tour/tour.libraries.yml @@ -0,0 +1,29 @@ +tour: + version: VERSION + js: + js/tour.js: {} + dependencies: + - core/jquery + - core/drupal + - core/backbone + - tour/jquery.joyride + - tour/tour-styling + +tour-styling: + version: VERSION + css: + component: + css/tour.module.css: { media: screen } + +# @todo Move into /core/assets and core.library.yml. +jquery.joyride: + remote: https://github.com/zurb/joyride + version: v2.0.3 + js: + js/jquery.joyride-2.0.3.js: {} + css: + component: + 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.libraries.yml b/core/modules/update/update.libraries.yml new file mode 100644 index 0000000..0661acc --- /dev/null +++ b/core/modules/update/update.libraries.yml @@ -0,0 +1,5 @@ +drupal.update.admin: + version: VERSION + css: + theme: + css/update.admin.css: {} diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 84357ca..0d8f649 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.libraries.yml b/core/modules/user/user.libraries.yml new file mode 100644 index 0000000..b5458d0 --- /dev/null +++ b/core/modules/user/user.libraries.yml @@ -0,0 +1,26 @@ +drupal.user: + version: VERSION + js: + user.js: {} + css: + component: + css/user.module.css: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once + +drupal.user.permissions: + version: VERSION + js: + user.permissions.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + +drupal.user.icons: + version: VERSION + css: + theme: + css/user.icons.css: {} diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 0b13fc5..703cdc8 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1925,51 +1925,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.libraries.yml b/core/modules/views/views.libraries.yml new file mode 100644 index 0000000..d9111bb --- /dev/null +++ b/core/modules/views/views.libraries.yml @@ -0,0 +1,33 @@ +views.module: + version: VERSION + css: + component: + css/views.module.css: {} + +views.ajax: + version: VERSION + js: + js/base.js: {} + js/ajax_view.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupalSettings + - core/jquery.once + - core/jquery.form + - core/drupal.ajax + +views.contextual-links: + version: VERSION + js: + # Ensure to run before contextual/drupal.contextual-links. + js/views-contextual.js: { weight: -10 } + dependencies: + - core/jquery + - core/drupal + +views.exposed-form: + version: VERSION + css: + component: + css/views.exposed_form.css: {} diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 5f1bc71..188834d 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -682,57 +682,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 f72f839..9ca6417 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 363a285..a10f803 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php @@ -170,7 +170,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.libraries.yml b/core/modules/views_ui/views_ui.libraries.yml new file mode 100644 index 0000000..cf92482 --- /dev/null +++ b/core/modules/views_ui/views_ui.libraries.yml @@ -0,0 +1,23 @@ +views_ui.admin: + version: VERSION + js: + js/ajax.js: {} + js/dialog.views.js: {} + js/views-admin.js: {} + 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: + js/views_ui.listing.js: {} + dependencies: + - core/jquery + - core/drupal + - core/jquery.once diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module index 348372d..97c202c 100644 --- a/core/modules/views_ui/views_ui.module +++ b/core/modules/views_ui/views_ui.module @@ -177,44 +177,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) { @@ -379,30 +341,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.libraries.yml b/core/themes/bartik/bartik.libraries.yml new file mode 100644 index 0000000..c864016 --- /dev/null +++ b/core/themes/bartik/bartik.libraries.yml @@ -0,0 +1,7 @@ +maintenance_page: + version: VERSION + css: + theme: + css/maintenance-page.css: {} + dependencies: + - system/maintenance diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index ab4683c..52c000c 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -133,23 +133,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.libraries.yml b/core/themes/seven/seven.libraries.yml new file mode 100644 index 0000000..b7c66d4 --- /dev/null +++ b/core/themes/seven/seven.libraries.yml @@ -0,0 +1,9 @@ +install-page: + version: VERSION + js: + js/mobile.install.js: {} + css: + theme: + install-page.css: {} + dependencies: + - system/maintenance diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index 2427bb7..99ceee4 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 page templates. */ function seven_preprocess_page(&$variables) { @@ -180,7 +157,7 @@ function seven_menu_local_action($variables) { $libraries = array( '#attached' => array( 'library' => array( - array('system', 'modernizr'), + array('core', 'modernizr'), ), ), ); @@ -207,7 +184,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'); } } @@ -220,13 +197,7 @@ function seven_preprocess_install_page(&$variables) { // Normally we could attach libraries via hook_page_alter(), but when the // database is inactive it's not called so we add them here. - $libraries = array( - '#attached' => array( - 'library' => array( - array('seven', 'install-page'), - ), - ), - ); + $libraries['#attached']['library'][] = array('seven', 'install-page'); drupal_render($libraries); }