- Issue created by @liquidcms
- π¨π¦Canada liquidcms
I enabled the Chosen Field module and now i do see the .js files loaded. I would have thought Chosen Field was to add to field as in fields added to an entity. This is not what i am doing, i am trying to use this on a term exposed filter in a view.
Regardless, even though i see the js files are loaded; i still do not get chosen applied to be exposed filter select list. In the views preview it partially works. There is no search bar but i can select items and they have pills added for those terms. But on my main site theme (bootstrap barrio) there is nothing.
I stumbled upon something that mentioned BEF so i tried that. Also does not work.
Perhaps this simply doesnt work with exposed filters?
- ππΊHungary nagy.balint
Hi!
You can apply chosen in the admin/config/user-interface/chosen page
by using the
"Minimum number of options for single select"
"Minimum number of options for multi select"
"Minimum number to show Search on Single Select"
and
"Apply Chosen to the following elements"Also chosen module has a dependency on chosen_lib, so you cannot install it without (as can be seen at chosen.info.yml):
dependencies:
- chosen:chosen_libas for composer, you can find instructions on how to install chosen lib with the composer repositories section.
at the "Installation with repository entry:" section of the Readme - π¨π¦Canada liquidcms
Thanks for this, and yes, i did stumble upon some combination of config that made this work.
regarding this though: "as for composer, you can find instructions on how to install chosen lib with the composer repositories section.
at the "Installation with repository entry:" section of the Readme" my question/suggestion was, why so complicated to install the lib? Is it not possible to have your own composer.json with your module that installs this?and i got chatgpt to answer my own question.. apparently not that easy to have your own composer.json do this. :(
- π¨π¦Canada liquidcms
and is usually the case with chatgpt.. its first answer is rarely correct. NONE of the other contrib modules we use require special care to install their required js libs. As an example, check out the dropzonejs project. This is the summary from chatgpt as to how it does this:
the dropzonejs module installs the Dropzone JS library automatically because:
- It includes a composer.libraries.json with a drupal-library package.
- The root projectβs composer.json includes installer paths for "drupal-library" to go to /libraries. - ππΊHungary nagy.balint
Yes unfortunately if we simply put it in the module's composer file, composer will install it in the wrong directory.
Drupal core could solve this issue globally, but as far as I know they did not yet.
There are numerous workarounds with each having some manual steps.
- ππΊHungary nagy.balint
#5 I think you mean the merge plugin which uses the libraries.json, that also requires some manual setup, it might work with this module as well although i have not tested it yet.
Otherwise the dropzonejs module's readme recommends the same repository entry approach as this module, so there really isn't much of a difference.
As far as I can see.