Issue #1996238 by sun, nod_, damiankloip, Wim Leers, longwave, alexpott, Xano, mdrummond, Mark Carver, Jeff Burnz, highrockmedia, joelpittet, et al: Replace hook_library_info() by *.libraries.yml file.

8.0.x
webchick 2014-02-22 20:56:51 -08:00
parent b673b60b95
commit f19fadd3a4
106 changed files with 1866 additions and 2709 deletions

678
core/core.libraries.yml Normal file
View File

@ -0,0 +1,678 @@
# 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/drupal.debounce
- 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.intrinsic:
version: VERSION
js:
misc/jquery.intrinsic.js: {}
dependencies:
- core/jquery
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 }

View File

@ -480,8 +480,8 @@ function ajax_pre_render_element($element) {
// Attach JavaScript settings to the element.
if (isset($element['#ajax']['event'])) {
$element['#attached']['library'][] = array('system', 'jquery.form');
$element['#attached']['library'][] = array('system', 'drupal.ajax');
$element['#attached']['library'][] = array('core', 'jquery.form');
$element['#attached']['library'][] = array('core', 'drupal.ajax');
$settings = $element['#ajax'];

View File

@ -191,7 +191,7 @@ function _batch_progress_page() {
),
),
'library' => array(
array('system', 'drupal.batch'),
array('core', 'drupal.batch'),
),
),
);

View File

@ -12,6 +12,8 @@ use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Exception\ParseException;
use Drupal\Component\PhpStorage\PhpStorageFactory;
use Drupal\Component\Utility\MapArray;
use Drupal\Component\Utility\NestedArray;
@ -2679,7 +2681,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
@ -2710,7 +2712,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) {
@ -2719,6 +2720,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'],
@ -2727,10 +2732,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;
@ -2762,62 +2763,179 @@ 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 = \Drupal::moduleHandler()->invoke($module, 'library_info');
if (empty($module_libraries)) {
$module_libraries = array();
}
// Allow modules to alter the module's registered libraries.
drupal_alter('library_info', $module_libraries, $module);
if (!isset($libraries[$extension]) && ($cache = cache()->get('library:info:' . $extension))) {
$libraries[$extension] = $cache->data;
}
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;
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 = $path . '/' . $extension . '.libraries.yml';
if ($library_file && file_exists(DRUPAL_ROOT . '/' . $library_file)) {
$libraries[$extension] = array();
$parser = new Parser();
try {
$libraries[$extension] = $parser->parse(file_get_contents(DRUPAL_ROOT . '/' . $library_file));
}
catch (ParseException $e) {
// Rethrow a more helpful exception, since ParseException lacks context.
throw new \RuntimeException(sprintf('Invalid library definition in %s: %s', $library_file, $e->getMessage()), 0, $e);
}
// Allow modules to alter the module's registered libraries.
drupal_alter('library_info', $libraries[$extension], $extension);
}
foreach ($libraries[$extension] as $id => &$library) {
if (!isset($library['js']) && !isset($library['css']) && !isset($library['settings'])) {
throw new \RuntimeException(sprintf("Incomplete library definition for '%s' in %s", $id, $library_file));
}
$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], 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];
}
/**
@ -2968,7 +3086,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');
}
@ -3531,7 +3649,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();

View File

@ -1647,7 +1647,7 @@ function theme_tableselect($variables) {
// checkboxes/radios in the first table column.
if ($element['#js_select']) {
// Add a "Select all" checkbox.
$table['#attached']['library'][] = array('system', 'drupal.tableselect');
$table['#attached']['library'][] = array('core', 'drupal.tableselect');
array_unshift($header, array('class' => array('select-all')));
}
else {
@ -1769,7 +1769,7 @@ function form_process_table($element, &$form_state) {
// Add a "Select all" checkbox column to the header.
// @todo D8: Rename into #select_all?
if ($element['#js_select']) {
$element['#attached']['library'][] = array('system', 'drupal.tableselect');
$element['#attached']['library'][] = array('core', 'drupal.tableselect');
array_unshift($element['#header'], array('class' => array('select-all')));
}
// Add an empty header column for radio buttons or when a "Select all"
@ -1969,7 +1969,7 @@ function form_process_machine_name($element, &$form_state) {
'langcode' => $language->id,
),
);
$element['#attached']['library'][] = array('system', 'drupal.machine-name');
$element['#attached']['library'][] = array('core', 'drupal.machine-name');
$element['#attached']['js'][] = $js_settings;
return $element;
@ -2062,7 +2062,7 @@ function form_pre_render_details($element) {
_form_set_attributes($element, array('form-wrapper'));
// Collapsible details.
$element['#attached']['library'][] = array('system', 'drupal.collapse');
$element['#attached']['library'][] = array('core', 'drupal.collapse');
if (empty($element['#collapsed'])) {
$element['#attributes']['open'] = 'open';
}
@ -2116,7 +2116,7 @@ function form_pre_render_group($element) {
if (isset($element['#group'])) {
// Contains form element summary functionalities.
$element['#attached']['library'][] = array('system', 'drupal.form');
$element['#attached']['library'][] = array('core', 'drupal.form');
$group = $element['#group'];
// If this element belongs to a group, but the group-holding element does
@ -2165,7 +2165,7 @@ function form_process_vertical_tabs($element, &$form_state) {
$element['#title_display'] = 'invisible';
}
$element['#attached']['library'][] = array('system', 'drupal.vertical-tabs');
$element['#attached']['library'][] = array('core', 'drupal.vertical-tabs');
// The JavaScript stores the currently selected tab in this hidden
// field so that the active tab can be restored the next time the
@ -2255,7 +2255,7 @@ function form_process_autocomplete($element, &$form_state) {
}
if ($access) {
$element['#attributes']['class'][] = 'form-autocomplete';
$element['#attached']['library'][] = array('system', 'drupal.autocomplete');
$element['#attached']['library'][] = array('core', 'drupal.autocomplete');
// Provide a data attribute for the JavaScript behavior to bind to.
$element['#attributes']['data-autocomplete-path'] = $path;
}

View File

@ -2079,7 +2079,7 @@ function install_configure_form($form, &$form_state, &$install_state) {
$form['#attached']['library'][] = array('system', 'drupal.system');
// Add JavaScript time zone detection.
$form['#attached']['library'][] = array('system', 'drupal.timezone');
$form['#attached']['library'][] = array('core', 'drupal.timezone');
// We add these strings as settings because JavaScript translation does not
// work during installation.
$js = array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail')));

View File

@ -5,6 +5,7 @@
* API for loading and interacting with Drupal modules.
*/
use Drupal\Core\Cache\Cache;
/**
* Builds a list of bootstrap modules and enabled modules and themes.
@ -112,6 +113,13 @@ function system_list_reset() {
drupal_static_reset('list_themes');
\Drupal::cache('bootstrap')->delete('system_list');
\Drupal::cache()->delete('system_info');
// Clear the library info cache.
// Libraries may be provided by all extension types, and may be altered by any
// other extensions (types) due to the nature of drupal_alter() and the fact
// that profiles are recorded and handled as modules.
Cache::invalidateTags(array('extension' => TRUE));
// Remove last known theme data state.
// This causes system_list() to call system_rebuild_theme_data() on its next
// invocation. When enabling a module that implements hook_system_info_alter()

View File

@ -1590,7 +1590,7 @@ function theme_table($variables) {
// Add sticky headers, if applicable.
if (count($header) && $sticky) {
drupal_add_library('system', 'drupal.tableheader');
drupal_add_library('core', 'drupal.tableheader');
// Add 'sticky-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'][] = 'sticky-enabled';
@ -1599,7 +1599,7 @@ function theme_table($variables) {
// with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM
// and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors.
if (count($header) && $responsive) {
drupal_add_library('system', 'drupal.tableresponsive');
drupal_add_library('core', 'drupal.tableresponsive');
// Add 'responsive-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'][] = 'responsive-enabled';
@ -2157,7 +2157,7 @@ function template_preprocess_html(&$variables) {
drupal_add_html_head($element, $name);
}
drupal_add_library('system', 'html5shiv', TRUE);
drupal_add_library('core', 'html5shiv', TRUE);
$variables['page_top'][] = array('#markup' => $page->getBodyTop());
$variables['page_bottom'][] = array('#markup' => $page->getBodyBottom());
@ -2431,26 +2431,8 @@ function template_preprocess_maintenance_page(&$variables) {
// These are usually added from system_page_build() except maintenance.css.
// When the database is inactive it's not called so we add it here.
$default_css['library'][] = array('system', 'normalize');
$path = drupal_get_path('module', 'system');
// Adjust the weights to load these early.
$default_css['css'][$path . '/css/system.module.css'] = array(
'weight' => CSS_COMPONENT - 10,
'every_page' => TRUE,
);
$default_css['css'][$path . '/css/system.theme.css'] = array(
'weight' => CSS_SKIN - 10,
'every_page' => TRUE,
);
// Unlike regular pages, the admin.css is added for every maintenance page.
$default_css['css'][$path . '/css/system.admin.css'] = array(
'weight' => CSS_COMPONENT - 10,
'every_page' => TRUE,
);
$default_css['css'][$path . '/css/system.maintenance.css'] = array(
'weight' => CSS_COMPONENT - 10,
'every_page' => TRUE,
);
$default_css['library'][] = array('core', 'normalize');
$default_css['library'][] = array('system', 'maintenance');
$attached = array('#attached' => $default_css);
drupal_render($attached);
$variables['messages'] = array(

View File

@ -124,7 +124,7 @@ class OpenDialogCommand implements CommandInterface {
*/
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'];

View File

@ -1,3 +1,6 @@
/**
* Drupal's batch API.
*/
(function ($, Drupal) {
"use strict";

View File

@ -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) {

View File

@ -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.

View File

@ -1,3 +1,6 @@
/**
* Drupal's states library.
*/
(function ($) {
"use strict";

View File

@ -0,0 +1,19 @@
drupal.block:
version: VERSION
js:
block.js: {}
dependencies:
- core/jquery
- core/drupal
drupal.block.admin:
version: VERSION
js:
js/block.admin.js: {}
css:
theme:
css/block.admin.css: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.ajax

View File

@ -547,37 +547,3 @@ function block_language_delete($language) {
}
}
}
/**
* Implements hook_library_info().
*/
function block_library_info() {
$libraries['drupal.block'] = array(
'title' => 'Block',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'block') . '/block.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
),
);
$libraries['drupal.block.admin'] = array(
'title' => 'Block admin',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'block') . '/js/block.admin.js' => array(),
),
'css' => array(
drupal_get_path('module', 'block') . '/css/block.admin.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.ajax'),
),
);
return $libraries;
}

View File

@ -145,7 +145,7 @@ class BlockListController extends ConfigEntityListController implements FormInte
}
$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';

View File

@ -0,0 +1,8 @@
drupal.book:
version: VERSION
js:
book.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.form

View File

@ -826,23 +826,3 @@ function book_node_type_update(NodeTypeInterface $type) {
function book_link_load($mlid) {
return entity_load('menu_link', $mlid);
}
/**
* Implements hook_library_info().
*/
function book_library_info() {
$libraries['drupal.book'] = array(
'title' => 'Book',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'book') . '/book.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.form'),
),
);
return $libraries;
}

View File

@ -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

View File

@ -31,108 +31,6 @@ function ckeditor_help($path, $arg) {
}
}
/**
* Implements hook_library_info().
*/
function ckeditor_library_info() {
$module_path = drupal_get_path('module', 'ckeditor');
$libraries['drupal.ckeditor'] = array(
'title' => 'Drupal behavior to enable CKEditor on textareas.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.js' => array(),
),
'css' => array(
$module_path . '/css/ckeditor.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.debounce'),
array('ckeditor', 'ckeditor'),
array('editor', 'drupal.editor'),
),
);
$libraries['drupal.ckeditor.admin'] = array(
'title' => 'Drupal behavior for drag-and-drop CKEditor toolbar builder UI.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.admin.js' => array(),
),
'css' => array(
$module_path . '/css/ckeditor.admin.css' => array(),
'core/assets/vendor/ckeditor/skins/moono/editor.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupalSettings'),
array('system', 'jquery.once'),
array('system', 'jquery.ui.sortable'),
array('system', 'jquery.ui.draggable'),
array('system', 'jquery.ui.touch-punch'),
array('system', 'backbone'),
array('system', 'drupal.dialog'),
array('system', 'drupal.announce'),
array('ckeditor', 'ckeditor'),
array('editor', 'drupal.editor.admin'),
// Depend on Vertical Tabs, so that Vertical Tabs' JavaScript is executed
// first, which ensures its behavior runs first.
array('system', 'drupal.vertical-tabs'),
),
);
$libraries['drupal.ckeditor.drupalimage.admin'] = array(
'title' => 'Only show the "drupalimage" plugin settings when its button is enabled.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.drupalimage.admin.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'drupal.vertical-tabs'),
array('system', 'drupalSettings'),
),
);
$libraries['drupal.ckeditor.stylescombo.admin'] = array(
'title' => 'Only show the "stylescombo" plugin settings when its button is enabled.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.stylescombo.admin.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'drupal.vertical-tabs'),
array('system', 'drupalSettings'),
),
);
$libraries['drupal.ckeditor.drupalimagecaption-theme'] = array(
'title' => 'Theming support for the imagecaption plugin.',
'version' => \Drupal::VERSION,
'js' => array(
$module_path . '/js/plugins/drupalimagecaption/theme.js' => array(),
),
'dependencies' => array(
array('ckeditor', 'ckeditor'),
),
);
$libraries['ckeditor'] = array(
'title' => 'Loads the main CKEditor library.',
'version' => '4.3-dev — d8-imagecaption branch commit 887d81ac1824008b690e439a1b29eb4f13b51212',
'js' => array(
'core/assets/vendor/ckeditor/ckeditor.js' => array(
'preprocess' => FALSE,
),
),
);
return $libraries;
}
/**
* Implements hook_theme().
*/

View File

@ -34,7 +34,7 @@ class DrupalImage extends CKEditorPluginBase implements CKEditorPluginConfigurab
*/
public function getLibraries(Editor $editor) {
return array(
array('system', 'drupal.ajax'),
array('core', 'drupal.ajax'),
);
}

View File

@ -33,7 +33,7 @@ class DrupalLink extends CKEditorPluginBase {
*/
public function getLibraries(Editor $editor) {
return array(
array('system', 'drupal.ajax'),
array('core', 'drupal.ajax'),
);
}

View File

@ -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

View File

@ -774,38 +774,3 @@ function _color_rgb2hsl($rgb) {
return array($h, $s, $l);
}
/**
* Implements hook_library_info().
*/
function color_library_info() {
$libraries['drupal.color'] = array(
'title' => 'Color',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/color.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'jquery.farbtastic'),
array('color', 'drupal.color.preview'),
),
);
$libraries['drupal.color.preview'] = array(
'title' => 'Color preview',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/preview.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupalSettings'),
array('system', 'jquery.once'),
),
);
return $libraries;
}

View File

@ -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

View File

@ -1583,60 +1583,3 @@ function comment_file_download_access($field, EntityInterface $entity, FileInter
return FALSE;
}
}
/**
* Implements hook_library_info().
*/
function comment_library_info() {
$path = drupal_get_path('module', 'comment');
$libraries['drupal.comment'] = array(
'title' => 'Comment',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/comment-entity-form.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.form'),
),
);
$libraries['drupal.comment-by-viewer'] = array(
'title' => 'Annotate comments by the current viewer for targeted styling',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/js/comment-by-viewer.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupalSettings'),
),
);
$libraries['drupal.comment-new-indicator'] = array(
'title' => 'New comment indicator',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/js/comment-new-indicator.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('history', 'drupal.history'),
array('system', 'drupal.displace'),
),
);
$libraries['drupal.node-new-comments-link'] = array(
'title' => 'New comments link',
'version' => \Drupal::VERSION,
'js' => array(
$path . '/js/node-new-comments-link.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('history', 'drupal.history'),
),
);
return $libraries;
}

View File

@ -98,7 +98,7 @@ class CommentFormController extends ContentEntityFormController {
$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';
}

View File

@ -155,7 +155,7 @@ class ConfigSync extends FormBase {
}
// 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)) {

View File

@ -0,0 +1,5 @@
drupal.config_translation.admin:
version: VERSION
css:
theme:
css/config_translation.admin.css: {}

View File

@ -195,16 +195,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;
}

View File

@ -53,7 +53,7 @@ class MessageFormController extends ContentEntityFormController {
'#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

View File

@ -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

View File

@ -414,30 +414,6 @@ function content_translation_delete_access(EntityInterface $entity, Language $la
return isset($languages[$language->id]) && $language->id != $entity->getUntranslated()->language()->id && isset($translations[$language->id]) && content_translation_access($entity, 'delete');
}
/**
* 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.
*

View File

@ -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

View File

@ -89,68 +89,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().
*/

View File

@ -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

View File

@ -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().
*
* 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.
* 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.
*
* @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,
);
}
}
}
}
}
@ -186,41 +145,3 @@ function edit_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisp
$build['#attributes']['data-edit-entity-id'] = $entity->getEntityTypeId() . '/' . $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;
}

View File

@ -95,13 +95,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');
}
}

View File

@ -0,0 +1,41 @@
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
- core/drupal.dialog
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

View File

@ -73,75 +73,6 @@ function editor_element_info() {
return $type;
}
/**
* 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'),
array('system', 'drupal.dialog'),
),
);
$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().
*/

View File

@ -77,8 +77,8 @@ class EditorManager extends DefaultPluginManager {
// 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),
@ -87,7 +87,7 @@ class EditorManager extends DefaultPluginManager {
);
}
// 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)) {
@ -96,7 +96,7 @@ class EditorManager extends DefaultPluginManager {
$attachments['js'][] = array(
'type' => 'setting',
'data' => array('editor' => array('formats' => $settings)),
'data' => $settings,
);
return $attachments;

View File

@ -37,8 +37,8 @@ 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;
}
}

View File

@ -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

View File

@ -225,30 +225,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().
*/

View File

@ -0,0 +1,11 @@
drupal.file:
version: VERSION
js:
file.js: {}
css:
theme:
css/file.admin.css: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings

View File

@ -1934,29 +1934,6 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag
* @} End of "defgroup file-module-api".
*/
/**
* 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().
*/

View File

@ -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: {}

View File

@ -1178,63 +1178,3 @@ function filter_filter_secure_image_alter(&$image) {
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;
}

View File

@ -0,0 +1,5 @@
forum.index:
version: VERSION
css:
component:
css/forum.module.css: {}

View File

@ -890,20 +890,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;
}

View File

@ -0,0 +1,9 @@
drupal.history:
version: VERSION
js:
js/history.js: {}
dependencies:
- core/jquery
- core/drupalSettings
- core/drupal
- core/drupal.ajax

View File

@ -183,27 +183,6 @@ function history_user_delete($account) {
->execute();
}
/**
* Implements hook_library_info().
*/
function history_library_info() {
$libraries['drupal.history'] = array(
'title' => 'History',
'version' => \Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'history') . '/js/history.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupalSettings'),
array('system', 'drupal'),
array('system', 'drupal.ajax'),
),
);
return $libraries;
}
/**
* #post_render_cache callback; attaches the last read timestamp for a node.
*

View File

@ -0,0 +1,8 @@
language.admin:
version: VERSION
js:
language.admin.js: {}
dependencies:
- core/jquery
- core/drupal
- core/jquery.once

View File

@ -557,26 +557,6 @@ function language_delete($langcode) {
return FALSE;
}
/**
* 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().
*

View File

@ -36,7 +36,7 @@ class LocaleLibraryInfoAlterTest extends WebTestBase {
* @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.');
}

View File

@ -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

View File

@ -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,
);
}
}

View File

@ -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

View File

@ -698,34 +698,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;
}

View File

@ -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

View File

@ -1897,50 +1897,6 @@ function node_language_delete($language) {
->execute();
}
/**
* 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.
*

View File

@ -0,0 +1,8 @@
drupal.path:
version: VERSION
js:
path.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.form

View File

@ -230,23 +230,3 @@ function path_entity_field_info($entity_type) {
return $info;
}
}
/**
* 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;
}

View File

@ -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

View File

@ -84,24 +84,6 @@ function picture_menu_link_defaults() {
return $links;
}
/**
* 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.
*

View File

@ -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: {}

View File

@ -501,32 +501,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;
}

View File

@ -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

View File

@ -709,32 +709,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.
*

View File

@ -0,0 +1,8 @@
drupal.statistics:
version: VERSION
js:
statistics.js: { scope: footer }
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings

View File

@ -260,28 +260,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().
*

View File

@ -162,7 +162,7 @@ class BulkForm extends FieldPluginBase {
*/
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)) {

View File

@ -80,7 +80,7 @@ class JavaScriptTest extends DrupalUnitTestBase {
*/
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 @@ class JavaScriptTest extends DrupalUnitTestBase {
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 @@ class JavaScriptTest extends DrupalUnitTestBase {
$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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
// 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
$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 @@ class JavaScriptTest extends DrupalUnitTestBase {
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 @@ class JavaScriptTest extends DrupalUnitTestBase {
// 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
// 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
*/
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 @@ class JavaScriptTest extends DrupalUnitTestBase {
/**
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
* 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 @@ class JavaScriptTest extends DrupalUnitTestBase {
// 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.');

View File

@ -14,13 +14,6 @@ use Drupal\simpletest\DrupalUnitTestBase;
*/
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 @@ class MergeAttachmentsTest extends DrupalUnitTestBase {
);
}
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 @@ class MergeAttachmentsTest extends DrupalUnitTestBase {
// 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.');

View File

@ -65,16 +65,11 @@ class NoJavaScriptAnonymousTest extends WebTestBase {
$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 . '"></script>';
$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('/(?<!html5)\.js/', "No other JavaScript exists.");
}
}

View File

@ -12,12 +12,20 @@ use Drupal\Component\Utility\Url;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Language\Language;
use Drupal\Core\Template\Attribute;
use Drupal\simpletest\WebTestBase;
use Drupal\simpletest\DrupalUnitTestBase;
/**
* Tests the markup of core render element types passed to drupal_render().
*/
class RenderElementTypesTest extends WebTestBase {
class RenderElementTypesTest extends DrupalUnitTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('system');
public static function getInfo() {
return array(
'name' => 'Render element types',
@ -26,6 +34,12 @@ class RenderElementTypesTest extends WebTestBase {
);
}
protected function setUp() {
parent::setUp();
$this->installConfig(array('system'));
$this->container->get('theme_handler')->enable(array('stark'));
}
/**
* Asserts that an array of elements is rendered properly.
*
@ -173,11 +187,9 @@ class RenderElementTypesTest extends WebTestBase {
$path = drupal_get_path('module', 'system');
$default_css = array(
'#attached' => array(
'css' => array(
$path . '/css/system.module.css',
$path . '/css/system.admin.css',
$path . '/css/system.maintenance.css',
$path . '/css/system.theme.css',
'library' => array(
array('core', 'normalize'),
array('system', 'maintenance'),
),
),
);
@ -230,7 +242,7 @@ EOT;
);
// We have to reset drupal_add_css between each test.
drupal_static_reset('_drupal_add_css');
drupal_static_reset();
// Test basic string for maintenance page content.
$elements = array(
@ -248,7 +260,7 @@ EOT;
$this->assertElements($elements);
// Test render array for maintenance page content.
drupal_static_reset('_drupal_add_css');
drupal_static_reset();
$elements[0]['name'] = "#theme 'maintenance_page' with content as a render array";
$elements[0]['value']['#content'] = array('#markup' => '<span>foo</span>');
$this->assertElements($elements);

View File

@ -604,8 +604,8 @@ class RenderTest extends DrupalUnitTestBase {
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(
@ -687,8 +687,8 @@ class RenderTest extends DrupalUnitTestBase {
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(
@ -714,7 +714,7 @@ class RenderTest extends DrupalUnitTestBase {
$expected_child_element = array(
'#attached' => array(
'library' => array(
array('system', 'drupal.collapse'),
array('core', 'drupal.collapse'),
),
),
'#post_render_cache' => array(

View File

@ -279,81 +279,6 @@ function hook_js_alter(&$javascript) {
$javascript['core/assets/vendor/jquery/jquery.js']['data'] = drupal_get_path('module', 'jquery_update') . '/jquery.js';
}
/**
* 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.
*
@ -367,23 +292,74 @@ 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.
*

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -139,52 +139,14 @@ 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().
*

View File

@ -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

View File

@ -944,27 +944,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;
}

View File

@ -0,0 +1,8 @@
drupal.text:
version: VERSION
js:
text.js: {}
dependencies:
- core/jquery
- core/jquery.once
- core/drupal

View File

@ -8,26 +8,6 @@
use Drupal\Component\Utility\Html;
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().
*/

View File

@ -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

View File

@ -495,77 +495,6 @@ function toolbar_get_rendered_subtrees() {
return $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.
*

View File

@ -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

View File

@ -39,54 +39,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().
*/

View File

@ -0,0 +1,5 @@
drupal.update.admin:
version: VERSION
css:
theme:
css/update.admin.css: {}

View File

@ -144,23 +144,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().
*/

View File

@ -44,7 +44,7 @@ class RegisterFormController extends AccountFormController {
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.

View File

@ -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: {}

View File

@ -1928,51 +1928,6 @@ function user_toolbar() {
return $items;
}
/**
* 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.
*/

View File

@ -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: {}

View File

@ -674,57 +674,6 @@ function views_hook_info() {
return $hooks;
}
/**
* 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
*

View File

@ -730,7 +730,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']);
@ -753,7 +753,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';

View File

@ -83,10 +83,10 @@ class ViewEditFormController extends ViewFormControllerBase {
$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');

View File

@ -167,7 +167,7 @@ class ViewListController extends ConfigEntityListController implements EntityCon
$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(

Some files were not shown because too many files have changed in this diff Show More