- Issue created by @ThuleNB
- 🇩🇪Germany ThuleNB
I deinstalled Chosen and deleted the library. From the README of 5.x:
If you are using Composer to manage your site's dependencies,
then the Chosen plugin will automatically be downloaded to `libraries/chosen`.When I install the Chose module I get a jquery.chosen library. It seems to me that the wrong library is being installed. It's not the noli42 library.
Does someone has an idea what going wrong here?
- 🇳🇱Netherlands undersound3
@thulenb Did you followed the steps outlined here https://git.drupalcode.org/project/chosen/-/blob/5.0.1/README.md?ref_typ...?
Perhaps some old references somewhere to the jquery version?
- 🇩🇪Germany ThuleNB
Well, I think I followed it. In my understanding it is described that there are several ways to install Chosen.
I used Composer to install the module and the library should be installed automatically. I can see that there's a library installed (jquery.chosen) but it seems to be not the correct one. As I understand from the Chosen module's description page, version 5.x doesn't need jquery.So what is the correct way to install Chosen? Do I need additionally need to install the library with a repository entry?
Installation with repository entry:
Add the following entry in the "repositories" section of your main composer.json file.{ "type": "package", "package": { "name": "noli42/chosen", "version": "3.0.0", "type": "drupal-library", "dist": { "url": "https://github.com/noli42/chosen/releases/download/3.0.0/chosen-assets-v3.0.0.zip", "type": "zip" } } },
Now you can run the following command to install chosen in the right folder:
composer require noli42/chosen:3.0.0
- 🇩🇪Germany ThuleNB
I'd like to try it with the repository entry but I am not sure how exactly the code needs to be added:
"repositories": { "drupal": { "type": "composer", "url": "https://packages.drupal.org/8" }, "0": { "type": "composer", "url": "https://packages.drupal.org/8" }, { "type": "package", "package": { "name": "noli42/chosen", "version": "3.0.0", "type": "drupal-library", "dist": { "url": "https://github.com/noli42/chosen/releases/download/3.0.0/chosen-assets-v3.0.0.zip", "type": "zip" } } }, },
This is how I try but I am getting parse errors when running composer. How exactly needs this to be added?
- 🇩🇪Germany ThuleNB
I finally got it.
Installation with repository entry is mandatory.What was confusing me in the README:
Download the Chosen js plugin (https://github.com/noli42/chosen) and extract the file under "libraries".
Download and enable the module.
Configure at Administer > Configuration > User interface > Chosen (requires administer site configuration permission)For me, the seemed to be all I need to do. Manually adding the chosen library didn't work. I needed to add it via repositoty entry.
Just in case someone else faces this problem.
- 🇭🇺Hungary nagy.balint
Hello!
I am glad that you have managed to solve the issue.
Technically the repository entry also takes the release from https://github.com/noli42/chosen/releases/tag/3.0.0 but we can likely improve the README of course.
Any suggestion for improving the README is welcome.