mrself/symfony-tree-form-type

Symfony package for tree form type

Installs: 51

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Language:TypeScript

Type:project

1.7.7 2021-05-03 11:02 UTC

README

Still under development!

Installing

composer require mrself/symfony-tree-form-type:^1.2.3

Make sure config/packages/twig.yaml has the following code:

twig:
    form_themes:
      - '@TreeType/tree_type.html.twig'

Assets

The main js asset is located here assets/dist/main.js. It should be required in your front-end bundle or just added to your html.

Usage

public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options)
{
    $builder->add('alternatives', MrTreeType::class, [
        'class' => DataClass::class,
        'tree' => [
            [
                'id' => '1',
                'text' => 'Item 1',
                'parent' => '#'
            ]
         ],
        'multiple' => true
    ]);
}