survos / tree-bundle
incorporate jstree, using twig and stimulus and api-platform
Installs: 1 279
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Type:symfony-bundle
Requires
- php: ^8.1
- api-platform/core: ^3.2.1
- doctrine/doctrine-bundle: ^2.10.2
- doctrine/orm: ^2.16.2
- doctrine/persistence: ^2.0 || ^3.2
- stof/doctrine-extensions-bundle: ^1.8
- survos/core-bundle: ^1.5.103
- survos/inspection-bundle: ^1.5.103
- symfony/config: ^7.0 || ^6.3.2
- symfony/dependency-injection: ^7.0 || ^6.3.5
- symfony/http-kernel: ^7.0 || ^6.3.5
- symfony/options-resolver: ^7.0 || ^6.3
- symfony/stimulus-bundle: ^2.12
- symfony/ux-twig-component: ^2.12
- tacman/twig-tree-tag: ^3.0.1
- twig/twig: ^3.7.1
Requires (Dev)
- phpstan/phpstan: ^1.10.39
- symfony/browser-kit: ^7.0 || ^6.3.2
- symfony/framework-bundle: ^7.0 || ^6.3.5
- symfony/phpunit-bridge: ^7.0 || ^6.3.2
- symfony/twig-bundle: ^6.3 || ^7.0
- symfony/var-dumper: ^7.0 || ^6.3.5
- dev-main
- 1.5.103
- 1.5.102
- 1.5.101
- 1.5.100
- 1.5.99
- 1.5.98
- 1.5.97
- 1.5.96
- 1.5.95
- 1.5.94
- 1.5.93
- 1.5.92
- 1.5.91
- 1.5.90
- 1.5.89
- 1.5.88
- 1.5.87
- 1.5.86
- 1.5.85
- 1.5.84
- 1.5.83
- 1.5.82
- 1.5.81
- 1.5.80
- 1.5.79
- 1.5.78
- 1.5.77
- 1.5.76
- 1.5.75
- 1.5.74
- 1.5.73
- 1.5.72
- 1.5.71
- 1.5.70
- 1.5.69
- 1.5.68
- 1.5.67
- 1.5.66
- 1.5.65
- 1.5.64
- 1.5.63
- 1.5.62
- 1.5.61
- 1.5.60
- 1.5.59
- 1.5.58
- 1.5.57
- 1.5.56
- 1.5.55
- 1.5.54
- 1.5.53
- 1.5.52
- 1.5.51
- 1.5.50
- 1.5.49
- 1.5.48
- 1.5.47
- 1.5.46
- 1.5.45
- 1.5.44
- 1.5.43
- 1.5.42
- 1.5.41
- 1.5.40
- 1.5.39
- 1.5.38
- 1.5.37
- 1.5.36
- 1.5.35
- 1.5.34
- 1.5.33
- 1.5.32
- 1.5.31
- 1.5.30
- 1.5.29
- 1.5.28
- 1.5.27
- 1.5.26
- 1.5.25
- 1.5.24
- 1.5.23
- 1.5.22
- 1.5.21
- 1.5.20
- 1.5.19
- 1.5.18
- 1.5.17
- 1.5.16
- 1.5.15
- 1.5.14
- 1.5.13
- 1.5.12
- 1.5.11
- 1.5.10
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.103
- 1.4.102
- 1.4.101
- 1.4.100
- 1.4.99
- 1.4.98
- 1.4.97
- 1.4.96
- 1.4.95
- 1.4.94
- 1.4.93
- 1.4.92
- 1.4.91
- 1.4.90
- 1.4.89
- 1.4.88
- 1.4.87
- 1.4.86
- 1.4.85
- 1.4.84
- 1.4.83
- 1.4.82
- 1.4.81
- 1.4.80
- 1.4.79
- 1.4.78
- 1.4.77
- 1.4.76
- 1.4.75
- 1.4.74
- 1.4.73
- 1.4.72
- 1.4.71
- 1.4.70
- 1.4.69
- 1.4.68
- 1.4.67
- 1.4.66
- 1.4.65
- 1.4.64
- 1.4.63
- 1.4.62
- 1.4.61
- 1.4.60
- 1.4.59
- 1.4.58
- 1.4.57
- 1.4.56
- 1.4.55
- 1.4.54
- 1.4.53
- 1.4.52
- 1.4.51
- 1.4.50
- 1.4.49
- 1.4.48
- 1.4.46
- 1.4.44
- 1.4.43
- 1.4.42
- 1.4.40
- 1.4.39
- 1.4.38
- 1.4.37
- 1.4.36
- 1.4.35
- 1.4.34
- 1.4.33
- 1.4.32
- 1.4.31
- 1.4.30
- 1.4.29
- 1.4.28
- 1.4.27
- 1.4.26
- 1.4.25
- 1.4.24
- 1.4.23
- 1.4.22
- 1.4.21
- 1.4.20
- 1.4.19
- 1.4.18
- 1.4.17
- 1.4.16
- 1.4.15
- 1.4.14
- 1.4.13
- 1.4.12
- 1.4.11
- 1.4.10
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.14
- 1.3.13
- 1.3.12
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.2.56
- 1.2.55
- 1.2.54
- 1.2.53
- 1.2.52
- 1.2.51
- 1.2.50
- 1.2.49
- 1.2.48
- 1.2.47
- 1.2.46
- 1.2.45
- 1.2.44
- 1.2.43
- 1.2.42
- 1.2.41
- 1.2.40
- 1.2.39
- 1.2.38
- 1.2.37
- 1.2.36
- 1.2.34
- 1.2.33
- 1.2.32
- 1.2.31
- 1.2.30
- 1.2.29
- 1.2.28
- 1.2.27
- 1.2.26
- 1.2.25
- 1.2.24
- 1.2.23
- 1.2.22
- 1.2.21
- 1.2.17
- 1.2.16
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
This package is auto-updated.
Last update: 2023-12-03 20:37:30 UTC
README
Working with hierarchical data can get complex quickly. Fortunately, there are tools to help. This bundle wraps 3 amazing tools together.
- a {% tree %} twig tag for recursively displaying a tree without writing a twig macro Wrapper for jstree using ApiPlatform. Also includes a {% tree %} twig tag.
- A stimulus controller that calls the jstree javascript library
- Some helpers to integrate with ApiPlatform for editing and creating tree nodes.
In addition to the above, the has a dependency on stof/doctrine-extensions-bundle to make doctrine entities hierarchical.
composer req survos/tree-bundle
Tree Tag
The {% tree %}
tag works almost like {% for %}
, but inside a {% tree %}
you can call {% subtree var %}
See more details at tacman/tree-tag.
{% tree item in menu %} {% if treeloop.first %}<ul>{% endif %} <li> <a href="{{ item.url }}">{{ item.name }}</a> {% subtree item.children %} </li> {% if treeloop.last %}</ul>{% endif %} {% endtree %}
symfony new tree-demo --webapp --version=next --php=8.2 && cd tree-demo composer config minimum-stability dev composer config extra.symfony.allow-contrib true composer req symfony/asset-mapper:^6.4 symfony/stimulus-bundle:2.x-dev survos/tree-bundle bin/console make:controller Tree -i cat > templates/tree.html.twig <<END {% extends 'base.html.twig' %} {% block body %} {% set food = [ {name: 'fruit', children: [ {name: 'apple', children: [ {name: 'Granny Smith'}, {name: 'Gala'}, {name: 'Fuji'}, ]}, {name: 'banana'} ]}, {name: 'veggies', children: [ {name: 'peas'}, {name: 'carrots'}, {name: 'beets'} ]}, ] %} <h2>Food Tree</h2> {% set _sc = '@survos/tree-bundle/tree' %} <div {{ stimulus_controller(_sc) }} {{ stimulus_target(_sc, 'html') }}> {% tree item in food %} {% if treeloop.first %}<ul>{% endif %} <li> {{ item.name }} {% subtree item.children|default([]) %} </li> {% if treeloop.last %}</ul>{% endif %} {% endtree %} </div> {% endblock %} END symfony server:start -d symfony open:local --path=/tree
Issue with AutoImport
"controllers": { "tree": { "main": "src/controllers/tree_controller.js", "webpackMode": "eager", "fetch": "lazy", "enabled": true, "autoimport": { "jstree/dist/themes/default/style.min.css": true } },