format_text multiple wrapping

format_text multiple wrapping

by Adam King -
Number of replies: 0

Just encountered an issue that makes it awkward to print my lesson modules to PDF using TCPDF. The no-overflow and text_to_html div elements produced with format_text, when written to a PDF, push the content down the page; the issue arises when the content is wrapped multiple times, inexplicably.


If I call

$lesson->load_all_pages();

and then loop over the returned pages from this, the `$page->contents` seem to have been processed with format_text. For some odd reason this results in content which is wrapped multiple times in no-overflow and text_to_html divs. 

<div class="no-overflow"><div class="text_to_html"><div class="no-overflow"><div class="text_to_html"><div class="no-overflow"><div class="text_to_html"><div class="no-overflow"><div class="text_to_html">

Not sure if this is normal behaviour or not but I've experienced this in multiple versions of Moodle, the format_text doesn't really change much; it's worth testing in moodle30 if you're going to.

It's also worth noting that, because a page has a reference to it's parent (the lesson), if I print the page using print_object then the pages shown inside of the lesson reference are not wrapped this way. No modification has been made to the content before pulling these pages

Average of ratings: -