Integration with chosen or select2 js

Created on 27 August 2019, almost 6 years ago
Updated 21 May 2025, about 1 month ago

Problem/Motivation

User story:

Given that I have a large number of options in a Views Jump Menu
As a user of the jump menu
I want to be able to search/filter the list of options
So that I can find the option that I am looking for.

It would be nice to be able to use the Views Jump Menu with the Chosen or Select2 JavaScript libraries.

More information:

  1. Chosen:
    1. homepage & demos, source code
    2. Drupal integration module
    3. npm, asset-packagist
  2. Select2:
    1. homepage, demos, source code
    2. Drupal integration module
    3. npm, asset-packagist

Proposed resolution

  1. Add a service to detect the presence of extra libraries which could be used to enhance the jump menu
  2. Add a control to the views_jump_menu format settings to let an administrator select an extra library; add an update hook to modify existing views_jump_menu configurations to add an (empty) extra library configuration option to ensure the config model is up-to-date
  3. Modify the theme code to detect if an extra library has been selected, and if so, attach that extra library to the render output
  4. Update tests to detect that extra libraries are output if selected

Remaining tasks

  1. Review and feedback
  2. RTBC and feedback
  3. Commit

User interface changes

Adds an "Include extra library" control to the Views Jump Menu format settings if an extra library can be detected.

API changes

Adds a hook_views_jump_menu_extra_libraries_alter(&$extraLibrariesList) to allow modules/themes which define libraries to indicate that those libraries could be used with views_jump_menu.

Data model changes

Adds an extra_library string to the jump menu views schema, to track which extra library should be used with that jump menu.

Release notes snippet

Added optional support for extra JavaScript libraries to enhance the behavior of the jump menu.

Original report by jbfelix

Hello,

How to apply chosen or select2 library ?

Thanks

Feature request
Status

Needs review

Version

1.0

Component

Documentation

Created by

🇧🇪Belgium jbfelix

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024