Build Status Total Downloads Latest Stable Version



PrestaCMSMediaBundle integrates Sonata Media in PrestaCMS.

For a ready to use demonstration of PrestaCMS, you should check the prestacms-sandbox available on github.

This bundles adds the following block type to your project :

  • Media Simple
  • Media Advanced
  • Gallery Simple
  • Gallery Advanced
  • Carousel
  • Carousel Advanced

Feel free to use it, extend it or take it as an example for your own block.


Get the bundle

php composer.phar require presta/presta/cms-media-bundle:dev-master --no-update
php composer.phar update presta/presta/cms-media-bundle

Update your AppKernel to register the bundle

// app/AppKernel.php
public function registerBundles()
    return array(
        // ...
        new Presta\CMSMediaBundle\PrestaCMSMediaBundle(),
        // ...

Media and Media advanced

This block allows you to add a sonata media.

The advanced media adds a title, a content and handle a layout parameter which allows you to have different rendering with the same block.

Here is an example with Creative theme :

Media advanced

The same thing for rendering galleries

Here is an example with Creative theme :

Gallery advanced

Carousel block allows you to add carousel based on a Sonata gallery. It contains three types of format : full, medium and small to be easily integrated in any kind of container.

Carousel Advanced works with Carousel entity and provide CRUD to manage it.

Here is an example with Creative theme :


Customize it for your project needs

Change rendering

This bundle provides blocks with a basic HTML structure, if you need to add some HTML elements, css class… the best way is to benefit of Symfony 2 way to override template.

First use easy-extends to generate your application bundle :

php app/console sonata:easy-extends:generate PrestaCMSMediaBundle --dest=src

Then you only need to override the template you need.

Add settings

If you need to add settings or functionalities, create your own application bundle with the command line above and create your own block.

Then either you need it as a new block and you should register it as a block service or you just want it to override the default block and you should add a parameter for the corresponding block class.

Have a look at the block.xml file for a full list of parameters :

  • Carousel: %presta_cms.block.carousel.class%
  • Carousel Advanced: %presta_cms.block.carousel_advanced.class%
  • Media:
  • Media Advanced: %presta_cms.block.media_advanced.class%
  • Gallery:
  • Gallery Advanced: %presta_cms.block.gallery_advanced.class%

Ask for help

If you need help about this project you can post a message on our google group

How to contribute

The best way to contribute is to use Github Pull Request system. Any contributions like translation, documentation, bug reporting…

This bundle is not meant to contain complex template or js librairies.

If you want to make advanced rendering maybe the best way to do that is to build a theme.

Want do contribute ? Just fork and edit it!