jquery_once-1.0.0/jquery_once.module
jquery_once.module
<?php
/**
* Alter core/jquery (if configured to do so) and re-add core/jquery.once.
*
* This functionality does not touch the new Drupal.once library introduced in Drupal 10.
*
* Implements hook_library_info_alter().
*
* @param $libraries
* @param $extension
* @return void
*/
function jquery_once_library_info_alter(&$libraries, $extension) {
if ($extension === 'core') {
$pathToJqueryOnceModule = \Drupal::service('extension.list.module')->getPath('jquery_once');
$libraries['jquery'] = [
'version' => '3.7.1',
'license' => [
'name' => 'MIT',
'url' => 'https://raw.githubusercontent.com/jquery/jquery/3.7.1/LICENSE.txt',
'gpl-compatible' => true,
],
'js' => [
'/' . $pathToJqueryOnceModule . '/lib/jquery_3.7.1_jquery.min.js' => [
'weight' => -20,
'minified' => true,
],
],
];
$libraries['jquery.once'] = [
'version' => '2.2.3',
'license' => [
'name' => 'GNU-GPL-2.0-or-later',
'url' => 'https://raw.githubusercontent.com/RobLoach/jquery-once/2.2.3/LICENSE.md',
'gpl-compatible' => true,
],
'js' => [
'/' . $pathToJqueryOnceModule . '/lib/jquery-once-2.2.3/jquery.once.min.js' => [
'weight' => -19,
'minified' => true,
],
],
'dependencies' => [
'core/jquery',
],
];
}
}