PHPackages                             hofff/contao-selectri - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. hofff/contao-selectri

ActiveContao-module

hofff/contao-selectri
=====================

A selection widget for large structured option sets.

4.0.9(4y ago)76.2k4[1 PRs](https://github.com/hofff/contao-selectri/pulls)4LGPL-3.0-or-laterPHPPHP ^7.1 || ^8.0

Since Aug 26Pushed 2y ago3 watchersCompare

[ Source](https://github.com/hofff/contao-selectri)[ Packagist](https://packagist.org/packages/hofff/contao-selectri)[ Docs](https://hofff.com/)[ RSS](/packages/hofff-contao-selectri/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (26)Used By (4)

backboneit\_selectri
====================

[](#backboneit_selectri)

A selection widget for large structured option sets.

Usage in DCA
------------

[](#usage-in-dca)

Input type token: `selectri`

### eval Parameters

[](#eval-parameters)

**Value retrieval**

The widgets canonical representation of selection values are arrays that map selected nodes' keys to arrays containing the selected nodes' key at the array key `_key` as well as additional data associated with this selected node.

If you work with the widget directly, it is strongly recommended that you use the getValue/setValue methods, which will always return values in this canonical representation form.

If you however use this widget in DCAs, it is desired that the widget's `value`*property* (which is used by the DCA) is converted to - on retrieval - or converted from - on set - a specific format. To avoid the registration of load/save callbacks, the `value` property maintains an array of selected options' keys or, if `max` is set to `1`, a single selected option's key. For commonly used conversions there exist the following eval properties to further modify the `value`'s property content:

- `findInSet` - boolean - defaults to `false`

    - get: Returns a comma-separated list of the selected options' keys. This behavior takes precedence over the `canonical` setting.
    - set: Strings are handled as comma-separated lists of selected options' keys and gets split at `,`. A normalization to the canonical form is done after.
- `canonical` - boolean - defaults to `false`

    - get: Returns the canonical form of the selection or, if `max` is set to `1`, only the selected option's data array.
    - set: A normalization to the canonical form is done.

**Basic widget configuration**

- `min` - integer, non-negative - defaults to `0`

    How many nodes must be selected at least.

    If the `max` parameter is less than the configured minimum, the `min`parameter will be considered equal to the configured maximum.
- `max` - integer, positive - defaults to `1`

    How many nodes can be selected at most.
- `mandatory` - boolean - *optional* - **deprecated**: the `min` parameter should be used

    If given and `true`, the `min` parameter will be set to `1`, if it is not `> 0` already. If given and `false`, the `min` parameter will be set to `0`.
- `multiple` - boolean - *optional* - **deprecated**: the `max` parameter should be used

    If given and `true`, the `max` parameter will be set to `PHP_INT_MAX`, if it is not `> 1` already. If given and `false`, the `max` parameter will be set to `1`.
- `searchLimit` - integer, positive - defaults to `20`

    The max nodes retrieved from searches.
- `sort` - string, one of `list`, `preorder`, `tree` - defaults to `list`

    The structure implied on the made selection

    - `list`: the selection is a list (order matters), the selection is sortable
    - `preorder` ***not implemented***: the selection is a set (order does not matter), the selection is not sortable and preordered
    - `tree` ***not implemented***: the selection is a tree, the selection can be arranged with tree properties
- `height` - string - defaults to `auto`

    The CSS value and unit of the CSS `height` property of the selection tree.
- `tl_class` - string - *optional*

    Only used in Backend.
- `class` - string - *optional*

    Use this to apply your custom CSS savely. You can use "radio" or "checkbox" to replace the Contao-style select (+) and deselect (x) icons with Windows legacy input-like icon images.
- `data` - string or an object implementing `SelectriDataFactory` - defaults to the string `SelectriContaoTableDataFactory`

    If a factory **object** is given, these factory will be used to generate a data instance for created widgets. The `setParameters` method is **not**called. This is the recommended way to provide a `SelectriData`, as all data implementation specific features and options can be properly configured through their factories.

    If a string is given, it must name a class implementing `SelectriDataFactory`. When creating the widget, a new factory instance is created and its `setParameters` method is called with the attributes of the widget (the widget's attributes contains all settings from the DCA's `eval`array).

**Factory specific configuration (used by `setParameters` method of the `SelectriDataFactory` class given in the `data` parameter)**

- `treeTable` - string - *optional*

    The name of the table to fetch tree nodes from.

    The parameter is used by `SelectriContaoTableDataFactory::setParameters`method and preconfigures the data according to common Contao standards like primary key column `id` and parent key column `pid`.
- `mode` - string - defaults to `all`

    The parameter is used by `SelectriTableDataFactory::setParameters`method.

    - `all`: all nodes are selectable
    - `leaf`: only leaf nodes are selectable
    - `inner`: only inner nodes are selectable

### Simple example for usage in DCA

[](#simple-example-for-usage-in-dca)

```
$GLOBALS['TL_DCA']['tl_mydca']['fields']['mySelectriField'] = array(
	...
	'inputType' => 'selectri',
	...
	'eval' => array(
    	// all values are the defaults
		'min'				=> 0,			// the selection can be empty
		'max'				=> 1,			// let the user select not more than 1 item
		'searchLimit'		=> 20,			// max search results
		'findInSet'			=> false,		// dont use csv
		'additionalInput'	=> false,		// no additional inputs via node content callback is injected
		'sort'				=> 'list',
		'height'			=> 'auto',		// the height of the tree widget
		'tl_class'			=> 'clr',		// some css-classes,
		'class'				=> '',			// use "radio" or "checkbox" to replace the icons
		'data'				=> 'SelectriContaoTableDataFactory', // the data factory class to use
		'treeTable'			=> 'tl_page',	// a DB-table containing the tree structure (Contao-like adjacency list)
		'mode'				=> 'all',		// which nodes are selectable: "all", "leaf", "inner"
	),
	...
);
```

### Advanced example for usage in DCA

[](#advanced-example-for-usage-in-dca)

Instead of using a implicit created factory instance by providing a factory class name in the previous example, you can preconfigure your own factory instance and have full access to all parameters used by the `SelectriData`-class produced by the factory.

```
$data = SelectriContaoTableDataFactory::create();

// use the tl_page table for the tree structure
$data->setTreeTable('tl_page');

// show all nodes
$data->getConfig()->setTreeMode('all');

// search the title and pageTitle column
$data->getConfig()->setTreeSearchColumns(array('title', 'pageTitle'));

// only show nodes matching the condition
$data->getConfig()->setTreeConditionExpr('type = \'regular\' AND tstamp > 0');

// only let the user select nodes matching the condition
$data->getConfig()->setSelectableExpr('hide  \'1\'');

// for more parameters see the factory class and the underlaying config class

$GLOBALS['TL_DCA']['tl_mydca']['fields']['mySelectriField'] = array(
	...
	'inputType' => 'selectri',
	...
	'eval' => array(
		'min'			=> 0,
		'max'			=> 1,
		'searchLimit'	=> 20,
		'tl_class'		=> 'clr',
		'class'			=> 'checkbox',

		// assign your preconfigured factory instance to the widgets configuration
		'data'			=> $data,
	),
	...
);
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 79.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~113 days

Recently: every ~187 days

Total

22

Last Release

1537d ago

Major Versions

3.2.0 → 4.0.0-rc12016-09-14

4.0.2 → 5.0.0-rc12017-11-10

PHP version history (3 changes)3.0.0-beta1PHP &gt;=5.4

4.0.0-rc1PHP ^5.6 || ^7.0

4.0.8PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/587472ee5114836a7eceba90df2b9247dbb944e9cf7f7e0a241ebff969571fe3?d=identicon)[backbone87](/maintainers/backbone87)

![](https://avatars.githubusercontent.com/u/1232819?v=4)[Nicky Hoff](/maintainers/frontendschlampe)[@frontendschlampe](https://github.com/frontendschlampe)

---

Top Contributors

[![backbone87](https://avatars.githubusercontent.com/u/1196313?v=4)](https://github.com/backbone87 "backbone87 (154 commits)")[![tristanlins](https://avatars.githubusercontent.com/u/343404?v=4)](https://github.com/tristanlins "tristanlins (19 commits)")[![frontendschlampe](https://avatars.githubusercontent.com/u/1232819?v=4)](https://github.com/frontendschlampe "frontendschlampe (14 commits)")[![dmolineus](https://avatars.githubusercontent.com/u/1186266?v=4)](https://github.com/dmolineus "dmolineus (3 commits)")[![psi-4ward](https://avatars.githubusercontent.com/u/1191572?v=4)](https://github.com/psi-4ward "psi-4ward (2 commits)")[![andreasisaak](https://avatars.githubusercontent.com/u/156767?v=4)](https://github.com/andreasisaak "andreasisaak (1 commits)")

---

Tags

treecontaowidgetselect

### Embed Badge

![Health badge](/badges/hofff-contao-selectri/health.svg)

```
[![Health](https://phpackages.com/badges/hofff-contao-selectri/health.svg)](https://phpackages.com/packages/hofff-contao-selectri)
```

###  Alternatives

[mvo/contao-group-widget

Adds a new group widget that allows repeating a set of DCA fields.

28124.3k31](/packages/mvo-contao-group-widget)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
