- Add the repository to the composer.json
#!yaml
...
"repositories": [
{
"type": "vcs",
"url": "git@github.com:SocialbitGmbH/SonataMediaTwigExtensionBundle.git"
}
],
...
- Add composer requirement
#!sh
composer require socialbit/sonatamediatwigextension-bundle:~1.0
- Add the bundle to the AppKernel
#!php
public function registerBundles()
{
...
new Socialbit\\SonataMediaTwigExtensionBundle\SocialbitSonataMediaTwigExtensionBundle(),
...
}
-
Use the new helper in your twig templates:
{% set mediaUrl = media_public_url(media, 'reference') %}
-
Enjoy