diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php index 1c08bc9..e6a4376 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php @@ -213,7 +213,7 @@ public function buildByExtension($extension) { } /** - * Parses a given library file and allows module to alter it. + * Parses a given library file and allows modules and themes to alter it. * * This method sets the parsed information onto the library property. * diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php index fae23f2..f3c5549 100644 --- a/core/modules/system/theme.api.php +++ b/core/modules/system/theme.api.php @@ -838,22 +838,25 @@ function hook_js_settings_alter(array &$settings, \Drupal\Core\Asset\AttachedAss } /** - * Alters the JavaScript/CSS library registry. - * - * Allows certain, contributed modules to update libraries to newer versions - * while ensuring backwards compatibility. In general, such manipulations should - * only be done by designated modules, since most modules that integrate with a - * certain library also depend on the API of a certain library version. - * - * @param $libraries - * The JavaScript/CSS libraries provided by $module. Keyed by internal library - * name and passed by reference. - * @param $module - * The name of the module that registered the libraries. + * Alter JavaScript/CSS library information. + * + * Allows modules and themes to change libraries' definitions, mostly used to + * update a library to newer version, while ensuring backwards compatibility. In + * general, such manipulations should only be done by designated modules and + * themes, since most modules and themes that integrate with a certain library + * also depend on the API of a certain library version. + * + * @param array $libraries + * An associative array of libraries registered by $extension. Keyed by + * internal library name and passed by reference. + * @param string $extension + * The machine name of the extension that registered the libraries. + * + * @see \Drupal\Core\Asset\LibraryDiscoveryParser::parseLibraryInfo() */ -function hook_library_info_alter(&$libraries, $module) { +function hook_library_info_alter(&$libraries, $extension) { // Update Farbtastic to version 2.0. - if ($module == 'core' && isset($libraries['jquery.farbtastic'])) { + if ($extension == 'core' && isset($libraries['jquery.farbtastic'])) { // Verify existing version is older than the one we are updating to. if (version_compare($libraries['jquery.farbtastic']['version'], '2.0', '<')) { // Update the existing Farbtastic to version 2.0.