MDL-65388 mod_book: format plugin file urls when printing book

This commit is contained in:
Ryan Wyllie
2019-04-30 10:45:01 +08:00
parent 14cdf51189
commit 8673975999
2 changed files with 5 additions and 2 deletions
@@ -79,7 +79,8 @@ class print_book_page implements renderable, templatable {
$data->printdialoglink = $output->render_print_book_dialog_link();
$data->booktitle = $OUTPUT->heading(format_string($this->book->name, true,
array('context' => $context)), 1);
$data->bookintro = format_text($this->book->intro, $this->book->introformat,
$introtext = file_rewrite_pluginfile_urls($this->book->intro, 'pluginfile.php', $context->id, 'mod_book', 'intro', null);
$data->bookintro = format_text($introtext, $this->book->introformat,
array('noclean' => true, 'context' => $context));
$data->sitelink = \html_writer::link(new moodle_url($CFG->wwwroot),
format_string($SITE->fullname, true, array('context' => $context)));
@@ -200,7 +200,9 @@ class renderer extends plugin_renderer_base {
}
}
$bookchapter .= format_text($chapter->content, $chapter->contentformat, array('noclean' => true, 'context' => $context));
$chaptertext = file_rewrite_pluginfile_urls($chapter->content, 'pluginfile.php', $context->id,
'mod_book', 'chapter', $chapter->id);
$bookchapter .= format_text($chaptertext, $chapter->contentformat, array('noclean' => true, 'context' => $context));
$bookchapter .= html_writer::end_div();
return array($bookchapter, $chaptervisible);