aleslanger / checkboxtree
Checkbox Tree control for Nette Framework.
v0.02
2018-09-19 08:30 UTC
Requires
- php: >= 5.6
- nette/application: ^2.4
- nette/di: ^2.4
- nette/forms: ^2.4
- nette/http: ^2.4
- nette/utils: ^2.4
This package is auto-updated.
Last update: 2025-03-20 03:44:13 UTC
README
Requirements
Installation
composer require aleslanger/checkboxtree
You can enable the extension using your neon config:
extensions: CheckBoxTree: aleslanger\Forms\CheckBoxTree\DI\CheckBoxTreeExtension
or register for example to bootstrap.php:
\aleslanger\Forms\CheckBoxTree\Bridges\ExtensionMethodRegistrator::register();
Usage
$form = new \Nette\Forms\Form; /* - First |___ - Third - Second */ $items = array( 1 => array('id' => 1, 'title' => 'First', 'parent_id' => ''), 2 => array('id' => 2, 'title' => 'Second', 'parent_id' => ''), 3 => array('id' => 3, 'title' => 'Third', 'parent_id' => 1),); $form->addCheckboxTree("list", "Label", $items);
the input array must contain keys (id, title, parent_id), key title is label for checkbox. The output is an array, the individual values are IDs.
License
The MIT License (MIT)