Search code examples
symfonysonata-adminsymfony-sonatasymfony-cmf

Override template of a Symfony BlockBundle SimpleBlock


I recently configured my website project to use Symfony CMF with Sonata Admin.

I'm now populating my website with random editable simple blocks, but can't figure out the way to override their rendering template.


Solution

  • There are two stacks of templates, once for use with the frontend editing CreateBundle and once without. The one for CreateBundle have a _createphp.html.twig at the end. Are you sure you overwrite the correct template? See https://github.com/symfony-cmf/BlockBundle/tree/master/Resources/views/Block

    When I debug such things, i try to edit the template in the vendor folder (make a syntax error, write "HELLO" or whatever) just to see if i am even trying to overwrite the correct template.

    In the title of this question you mix sonata and cmf. The cmf block bundle builds on sonata block bundle, but provides a couple of block types. Are you sure you have the paths right?