Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrself/symfony-tree-form-type
Symfony 4 tree from type based on JsTree plugin.
https://github.com/mrself/symfony-tree-form-type
symfony symfony-bundle symfony4 tree-form
Last synced: about 1 month ago
JSON representation
Symfony 4 tree from type based on JsTree plugin.
- Host: GitHub
- URL: https://github.com/mrself/symfony-tree-form-type
- Owner: mrself
- License: mit
- Created: 2021-01-12T07:44:11.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-03T11:02:40.000Z (almost 4 years ago)
- Last Synced: 2024-11-24T16:02:06.294Z (2 months ago)
- Topics: symfony, symfony-bundle, symfony4, tree-form
- Language: TypeScript
- Homepage:
- Size: 668 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Symfony tree form plugin
**Still under development!**
## Installing
`composer require mrself/symfony-tree-form-type:^1.2.3`
Make sure `config/packages/twig.yaml` has the following code:
```yaml
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
```php
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
]);
}
```