Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mazahaca/sonata-admin-tree-bundle
This bundle integrates jsTree and Gedmo Nested Set directly to Sonata Admin
https://github.com/mazahaca/sonata-admin-tree-bundle
jstree nested-set sonata-admin symfony tree tree-bundle
Last synced: about 2 months ago
JSON representation
This bundle integrates jsTree and Gedmo Nested Set directly to Sonata Admin
- Host: GitHub
- URL: https://github.com/mazahaca/sonata-admin-tree-bundle
- Owner: maZahaca
- License: mit
- Created: 2016-07-24T15:30:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-05-22T10:02:44.000Z (over 2 years ago)
- Last Synced: 2024-10-06T23:05:48.322Z (3 months ago)
- Topics: jstree, nested-set, sonata-admin, symfony, tree, tree-bundle
- Language: HTML
- Size: 52.7 KB
- Stars: 30
- Watchers: 6
- Forks: 19
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sonata-admin-tree-bundle
This bundle integrates [jsTree](https://www.jstree.com/) and [Gedmo Nested Set](https://github.com/stof/StofDoctrineExtensionsBundle) directly to [Sonata Admin](https://sonata-project.org/).A tree builds itself in an asynchronous way. Hence, it's quite good for big trees.
## Installation
### Install requirements
**SonataAdminBundle**
\- the SonataAdminBundle provides an installation article here:
http://symfony.com/doc/current/bundles/SonataAdminBundle/index.html**StofDoctrineExtensionsBundle**
\- then you need to install StofDoctrineExtensionsBundle
https://symfony.com/doc/master/bundles/StofDoctrineExtensionsBundle/index.html**Enable Tree Extension**
\- nested behaviour will implement the standard Nested-Set behaviour on your Entity
https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md### Install TreeBundle
Install it via composer
```bash
composer require redcode/tree-bundle
```Register the bundle in your app kernel `./app/AppKernel.php`
```php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
...
new RedCode\TreeBundle\RedCodeTreeBundle(),
);
...
}
}
```Add the following lines to the routing file `./app/config/routing.yml`
```yml
redcode_tree:
resource: "@RedCodeTreeBundle/Resources/config/routing.yml"
prefix: /admin
```For the entity with enabled [Gedmo Nested Set](https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md) follow these steps:
Extend Admin class from `\RedCode\TreeBundle\Admin\AbstractTreeAdmin`
```php
class SubjectAdmin extends AbstractTreeAdmin
{
...
}
```Extend AdminController from `\RedCode\TreeBundle\Controller\TreeAdminController`
```php
class SubjectAdminController extends TreeAdminController
{
...
}
```When registering the admin as a service, you need to provide a fourth argument - the name of the field that will be shown in the tree.
```yml
app.admin.subject:
class: AppBundle\Admin\SubjectAdmin
arguments: [~, AppBundle\Entity\Subject, AppBundle:SubjectAdmin, 'word']
tags:
- {name: sonata.admin, manager_type: orm, group: Search, label: Subject}
```## How it looks like
![redcode/tree-bundle](http://g.recordit.co/QwdbrR3P9R.gif)