Sonata Media Bundle:访问媒体网址 [英] Sonata Media Bundle : acces media url
本文介绍了Sonata Media Bundle:访问媒体网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am using sonata media bundle.
and I was wondering how can I access the media url in twig.
I just want the url, I do not need to show the media.
Any suggestions?
解决方案
You have to use the path media helper:
{% path media, 'small' %}
In the above code, media
is an instance of the media entity, and small
is the chosen format.
http://sonata-project.org/bundles/media/master/doc/reference/helpers.html#twig-usage
这篇关于Sonata Media Bundle:访问媒体网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文