Download the PHP package heimrichhannot/contao-choices-bundle without Composer

On this page you can find all versions of the php package heimrichhannot/contao-choices-bundle. 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 contao-choices-bundle

Contao Choices Bundle

This bundle offers support for the JavaScript library Choices.js for the Contao CMS.

Features

Setup

  1. Install via composer: composer require heimrichhannot/contao-choices-bundle.
  2. Update Database
  3. Encore Bundle: Prepare and generate encore entries

Usage

Active or deactivate choices support on page level (Layout section). You can activate/deactivate it separately for select and text boxes. You can overwrite settings from a parent page.

It is possible to active and deactivate choices support for single field as well.

Using DCA configuration:

Using CustomizeChoicesOptionsEventListener

NOTE: Choices are enabled by default if activated on page level.

Configuration

Each field can be customized via DCA:

All options from Choices.js can be found at https://github.com/Choices-js/Choices#setup

NOTE: the only option not from choices.js is

Filter Bundle

Choices.js support it automatically added to choice type form fields. It can be disabled in the type configuration. For other config types it can be activated in the configuration.

Developers

PHP Events

To customize options passed to the choices.js library, you can use the CustomizeChoicesOptionsEvent. Register an event listener to huh.choices.customize_choices_options. This work for 'normal' widgets and filter bundle fields. In your event listener you check, if the event comes from an filter bundle field by calling CustomizeChoicesOptionsEvent::isFilterField(): bool. In this case, the complete (but cloned) AdjustFilterOptionsEvent is passed to the event and the fieldAttributes array is empty. If you don't use filter bundle, you can ignore the filter bundle part.

JavaScript Events

Following events can be used to further customize the choices instances:

Event name Data Description
hundhChoicesOptions options Customize options before instantiating the choice object.
hundhChoicesNewInstance instance Is dispatched right after the choices instance is create.

Example:

Custom usage

If you use the library in a different way than this bundle provides (e.g. a custom module), use the frontend asset service to dynamically add the frontend assets.


All versions of contao-choices-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-json Version *
contao/core-bundle Version ^4.9
heimrichhannot/contao-encore-contracts Version ^1.0
heimrichhannot/contao-utils-bundle Version ^2.196
psr/container Version ^1.0 || ^2.0
symfony/service-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/event-dispatcher-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/dependency-injection Version ^4.4 || ^5.4
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 heimrichhannot/contao-choices-bundle contains the following files

Loading the files please wait ....