Problem/Motivation
Hello project maintainers,
This issue is to help make this module compatible with Drupal 10.
Patches will be added to this issue that remove Drupal 10 deprecated API uses.
Remaining tasks
------ ------------------------------------------------
modules/contrib/select2/select2.libraries.yml
------ ------------------------------------------------
The 'select2.min' library is depending on a deprecated library. The core/jquery.once asset library is deprecated in Drupal 9.3.0 and will be removed in Drupal 10.0.0. Use the core/once library instead.
See https://www.drupal.org/node/3158256
------ ------------------------------------------------
line modules/contrib/select2/modules/select2_facets/src/Plugin/facets/widget/Select2Widget.php
------ ------------------------------------------------
109 The 'select2_facets/drupal.select2_facets.select2-widget' library is not defined because the defining extension is not installed. Cannot decide if it is deprecated or not.
------ ------------------------------------------------
modules/contrib/select2/modules/select2_publish/src/Element/StatusProperties.php
------ ------------------------------------------------
54 The 'select2_publish/select2.publish' library is not defined because the defining extension is not installed. Cannot decide if it is deprecated or not.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | interdiff_5_9.txt | 995 bytes | ameymudras |
| #9 | 3310051-9.patch | 2.83 KB | ameymudras |
| #7 | Upgrade status.png | 94.45 KB | ameymudras |
| #7 | console error.png | 108.86 KB | ameymudras |
| #5 | select2-3310051-4.patch | 2.21 KB | reenaraghavan |
Issue fork select2-3310051
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anchal_gupta commentedI have uploaded the patch. please review
Comment #3
psingh10 commentedComment #5
reenaraghavan commentedAttached patch. Needs review.
Comment #6
berdirComment #7
ameymudras commentedTested this module on Drupal 10.0.x and php 8.1 & following are my observations
- The patch #5 applies cleanly
- Was able to install 'Select2', 'Select2 Publish' and 'Select2 Facets' modules
- For node article tags taxonomy reference field used Select2 widget with default options
- Node add page the taxonomy reference field doesn't render correctly and there is a js error in the console
- Upgrade status also mentions a couple of issues which need to be fixed
- modules/select2_facets/js/select2-widget.js makes use of .once
Comment #8
berdirthis is not correctly converted. forEach works different and an argument needs to be passed in.
The easier, minimal fix is to pass once() to a jquery object like this: $(once()).each(... then the rest can remain unchanged.
Comment #9
ameymudras commentedAdding a patch to fix the above issues
Comment #10
dishakatariya commentedHi, @ameymudras, Verified and tested given patch #9. and checked in upgrade status. This is giving errors.
Comment #11
kristen pol@DishaKatariya What errors? Can you post into a comment please?
Moving back to needs work based on #10.
Comment #12
dishakatariya commentedIt is compatible in upgrade status but giving warning errors now.
Comment #13
dishakatariya commentedComment #14
dishakatariya commentedComment #15
chr.fritschI have prepared a PR on github for D10 compatibility. Would be nice to get some reviews
https://github.com/thunder/select2/pull/121
Comment #16
kristen polWorking during porting day.
@chr.fritsch Thanks for the changes. The expected workflow is to either update the patch from #9 and attach it here or create an MR (GitLab) and use that. Would you be able to do one of these approaches so it's easier for the community to review and test with existing tools like DrupalPod? Thanks.
Comment #17
chr.fritschHi @Kristen Pol: The development of the select2 module has always been on github. I am trying to move it to d.o. in #3271610: Move testing to d.do to make it easier for the community, but some tests are failing on d.o. that are not failing locally or on github. So, until #3271610: Move testing to d.do is not fixed, the development will stay on github.
Comment #18
kristen polOh! My mistake then… I didn't realize… thanks for the info.
Comment #20
chr.fritschI was able to invest some time and was able to finally move the select2 tests to drupal.org. Thanks to gitlab CI. Yay 🥳
So this issue has now a gitlab MR and is successfully tested by gitlab ci :)
Comment #21
kristen polGreat 👍 Let us know how we can help 🙂
Comment #22
daniel.bosenlgtm
Comment #24
kristen polYay! Since you committed this, moving this back to Active for now so no one works on this but the bot can add patches. Feel free to marked fixed though :)
Community folks, see the compatible release here: https://www.drupal.org/project/select2/releases/8.x-1.x-dev
Comment #25
kristen polOh! This isn't a bot issue 😂
@chr.fritsch Can this issue be moved to fixed or is there more to do?
Comment #26
chr.fritschComment #27
laura.gatesAdding a FYI: If you're having issues with Select2 and PHP 8.1 try to download the latest develop version of the library (https://github.com/select2/select2) and replace it with the 2020 release.