Download the PHP package db-web-solutions/drupal-tom-select without Composer

On this page you can find all versions of the php package db-web-solutions/drupal-tom-select. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package drupal-tom-select

Tom Select

Contents of this file

Introduction

The Tom Select module provides an opt-in Drupal integration for Tom Select, a JavaScript select enhancement library.

The module is intentionally narrow in scope. It does not replace every select element on the site automatically. Site builders and developers choose where Tom Select is enabled.

The module provides:

This module does not provide a new field type. Existing Drupal field storage and field data remain unchanged. The module only changes the form widget and browser interaction for supported select elements.

Requirements

This module requires:

The expected local library files are:

Recommended modules

No additional Drupal modules are required.

The module can be used with Drupal core field widgets and Form API select elements. It is also suitable for custom modules that build their own forms.

Installation

Install the Drupal module as usual for a contributed or custom module.

If the module is installed through Composer:

If the module is installed manually, place it in a Drupal module directory such as:

or:

Then enable it:

Installing Tom Select

Download the Tom Select distribution from the upstream project and place the compiled files in Drupal's libraries directory:

The library directory should keep the upstream license files. Tom Select is licensed under Apache-2.0.

The Drupal module code is licensed under GPL-2.0-or-later.

Configuration

There is no global configuration page.

Tom Select is enabled per form element or per field widget. This prevents the module from changing unrelated select elements across a site.

Form API usage

Custom forms can opt in by adding #tom_select to a select element:

Tom Select options can be passed through #tom_select_options:

Multiple select example:

Developers may also call the helper function:

Field widget usage

For configurable fields:

  1. Go to Manage form display for the entity bundle.
  2. Select the Tom Select widget for a supported field.
  3. Save the form display.
  4. Clear Drupal caches if the widget does not appear immediately.

Supported field types:

The field widget reuses Drupal core option handling. It does not change field storage, submitted values, or entity data structure.

Library files and licensing

The module references Tom Select as a local Drupal library:

The referenced files are root-relative to the Drupal web root:

When distributing a project that includes Tom Select files, keep the upstream Tom Select LICENSE and NOTICE files with the library.

Do not remove upstream copyright notices from the compiled library files.

Troubleshooting

Tom Select is not applied to a form element

Check that the element is a select element and that #tom_select is set:

Also check that Drupal caches were cleared after enabling the module:

Browser console says TomSelect is not defined

The Tom Select JavaScript file is probably missing or installed at a different path.

Verify this file exists:

Styles are missing

Verify this file exists:

The field widget does not appear

Confirm the field type is supported. The widget is available for entity reference and list fields.

Development

Install development dependencies:

Run PHPCS:

Run PHPStan:

PHPStan is configured at level 9.

Auto-fix PHPCS issues where possible:

Maintainers

Current maintainers:


All versions of drupal-tom-select with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
drupal/core Version ^10.3 || ^11
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package db-web-solutions/drupal-tom-select contains the following files

Loading the files please wait ...