Closed nacmartin closed 11 years ago
we could use validation annotations on children/reference mappings in our documents and make the admin bundle aware of them.
but maybe we want something more that can be used with the tree as well.
@uwej711 played with the code i started and says:
hier: https://github.com/uwej711/cmf-sandbox/tree/valid_children und hier: https://github.com/uwej711/SonataDoctrinePhpcrAdminBundle/tree/valid_children und hier: https://github.com/uwej711/TreeBrowserBundle/tree/valid_children
Was ich ändern musste: die types haben wohl gar nichts mit dem Kontextmenü des Trees zu tun, ehrlich gesagt keine Ahnung, was man da tun muss. Damit das Kontextmenü passt, muss man für die items eine JS-Funktion hinterlegen, die ausgehend vom selektieren Node das Kontextmenü zusammen baut.
Mir gefällt nicht, dass ich da jetzt config.doctypes und config.types zusammen verwurschtle, das kann man sicher besser machen, indem man im Controller eine Struktur erzeugt und in die config packt (config.validChildren als Array('className' => array('label' => '
I also thought about the mixup with the tree bundle and I think we need some refactoring to make the tree bundle working just with the tree interface. If I find some time I will look into that again.
@uwej711 is this now fully working or still missing something after #73 was merged?
Now this works only via the configured valid children.
see valid_children on document_tree config http://symfony.com/doc/master/cmf/tutorials/creating-cms-using-cmf-and-sonata.html#configuration
The idea is that you can restrict the content document type nodes to be possible to create or move them into a given subtree. Same use case for routes, menus, ...