Search code examples
symfonysymfony-cmf

Symfony CMF BlockBundle default admin can't change parent


With the default admin classes for the BlockBundle (1.0.*) in Symfony CMF, I am unable to modify the "parent" of a block.

The parent filed is disabled (both when adding and editing), but always shows "/cms/content".

I would like to just use the admin classes and be able to set the parent of a block (particularly to setup some container blocks with content).

Why is it disabled? Do I need some common root for blocks to get it to work? If I tried to create my own admin class, I'm not sure what to do because the admin class does add the "parent" field the same way I would.


Solution

  • I was missing the proper Sonata admin configuration to allow this. Thanks dbu for pointing out that it works in the sandbox.

    sonata_doctrine_phpcr_admin:
        document_tree:
            ...
            Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock:
                valid_children: []
            Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ActionBlock:
                valid_children: []
            Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock:
                valid_children: []
            Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SlideshowBlock:
                valid_children:
                    - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ImagineBlock
            Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ImagineBlock:
                valid_children: []
            Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\RssBlock:
                valid_children: []
            Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock:
                valid_children:
                    - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock
                    - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock
                    - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock
                    - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ActionBlock
                    - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SlideshowBlock
                    - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\RssBlock
            ...