Drupal 11 Compliance jQuery 4 and Local Assets

Created on 5 November 2024, 18 days ago

Problem/Motivation

The select2 library is showing it's age.
But unforunately you can't patch the CDN version to work in your specific build of Drupal.

Steps to reproduce

No worries, I added the ability to download local copies of the library so that you can follow it up with your own patches to fix the library in your build.

Also if the local libraries don't exist it will load from the external CDN.

Select2 integration module.
Select2 is a jQuery-based replacement for select boxes. It supports searching, remote data sets, and pagination of results.

To get started, check out examples and documentation at https://select2.org/

This module integrates it into select fields in forms within Drupal.

Edit: 2024-11-05
Robert Foley (emptyvoid)
https://www.drupal.org/u/emptyvoid β†’

Extended the module to allow local libraries to reduce outbound traffic and to enable the ability to "Patch" libraries. If the libraries are not local it should load from an external CDN.

How to include via Composer:

Add to your packages array:
{
"type": "package",
"package": {
"name": "select2/select2",
"version": "4.0.13",
"type": "drupal-library",
"extra": {
"installer-name": "jquery.select2"
},
"dist": {
"url": "https://github.com/select2/select2/archive/4.0.13.zip",
"type": "zip"
},
"require": {
"composer/installers": "^2"
}
}
},

Now require it in your project:

composer require 'select2/select2'

Should download and install into the libraries sub directory of your drupal root directory.

πŸ› Bug report
Status

Active

Version

1.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States emptyvoid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024