Moodle Grid Format doesn’t render images
If you are using the Moodle course grid format, then you might find it doesn’t render images and instead creates URLs that have @@pluginfile@@
in them. This is a sign that these URLs have not been through the lib/filelib.php file_rewrite_pluginfile_urls()
function.
To fix this, you’ll need to edit the file course/format/grid/format.php
Find this section:
if (has_capability('moodle/course:viewhiddensections', $context) or $thissection->visible) { ... }
Replace this:
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
With this:
$summarytext = file_rewrite_pluginfile_urls($thissection->summary, 'pluginfile.php', $context->id, 'course', 'section', $thissection->id);
echo $summarytext;
Another solution to this would be to use the format_summary_text()
function in course/format/renderer.php
which basically takes the step above, but I think this would need a bigger code change. However it might be the correct way to fix this issue long term.