aleslanger/checkboxtree

Checkbox Tree control for Nette Framework.

v0.02 2018-09-19 08:30 UTC

This package is auto-updated.

Last update: 2024-04-20 01:47:12 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)