I've got a problem with Media module for Drupal 7, it works great all over the site, except in a custom module I've created. The field that is used by this module, uses the same text formatting as rest of site, it properly renders bolds, tables, all TinyMCE things. But somehow it can't handle images inserted by media plugin.
If I add ordinary article content type, then it works ok. Only fields rendered by my module are not parsed.
So - I display a field by:
echo '<p class="product-section-content">' . $element['value'] . '</p>'."\n";
but, instead of image I get:
[[{"type":"media","view_mode":"media_large","fid":"71","attributes":{"alt":"","class":"media-image","typeof":"foaf:Image"}}]][[{"type":"media","view_mode":"media_large","fid":"63","attributes":{"alt":"","class":"media-image","typeof":"foaf:Image"}}]]
What should I call, to parse this markup tags?
It's because the Media module provides a new input filter that's not activated by default. This filter is required to parse the media tags.
You need to go to admin/config/content/formats, edit the text format(s) you want to use with media, and enable the Converts Media tags to Markup checkbox for each.
Then it'll work :)
For Media module (1.x branch only) you can normally use the media_filter function:
print media_filter(html);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With