问题
Installed both SonataMediaBundle, SonataNewsBundle and SonataAdminBundle (and much more but these matter).
When posting a news item via the admin I choose to use the markdown configured as bellow.
sonata_formatter:
formatters:
markdown:
service: sonata.formatter.text.markdown
extensions:
- sonata.formatter.twig.control_flow
- sonata.formatter.twig.gist
- sonata.media.formatter.twig
The formatter formats all titles etc. as expected however, media are not formatted. Though, I found some different document about the syntax non of them where parsed.
Formats found:
<% 1552362, 'gistfile1.txt'%>
<% media 4, 'small' %>
{% thumbnail 4, 'small' %}
So.
- I could be wrong on the syntax
- Some extra configuration is needed
- Some custom coding needs to be done
- Something should be done at the front end?
- Or I am really missing something?
回答1:
<% media 4, 'small' %>
works correctly, however, you should make sure that your cache is cleared!
来源:https://stackoverflow.com/questions/10562850/setup-sonatanewsbundle-to-handle-media-in-posts