Question

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.

Was it helpful?

Solution 2

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
        ...

OTHER TIPS

I suspect you have a javascript issue with your installation. Did the installation finish successfully, and are you accessing the site through app_dev.php or did run all the composer commands listed in the setup?

You should have a tree of documents above that field with the path. Have a look at the sandbox demo install:

http://cmf.liip.ch/en/admin/cmf/block/simpleblock/cms/content/home/additionalInfoBlock/child1/edit

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top