Search code examples
symfonysymfony-sonatasymfony-cmf

Enabling tree browsing for custom content


I want to create a custom PHPCR document for a set of pages that I have in my website. I extended the SimpleCms/Page class and I created my object and persisted it using the document manager. I can see the content using node:dump command and in the database But I can't see it in the treebrowser.

So I want to know what are the other things I should provide to let the treebrowser display my custom branch.


Solution

  • You need to declare that your document may show up in the tree.

    document_tree:
        Acme\DemoBundle\Document\YourPage:
            valid_children:
                - Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page
        Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
            valid_children:
                - Acme\DemoBundle\Document\YourPage
    

    More information is in the sonata doc.