HTML auto cleaning from template: table tag in header, tr in record

HTML auto cleaning from template: table tag in header, tr in record

by Sergey E -
Number of replies: 0

Hi!

I'm using fresh install of Moodle 3.8, and creating an HTML template to output custom SQL report in similar way as it described in documentation:
https://docs.moodle.org/38/en/Configurable_reports#Templates

header:

<table>

record template:

<tr><td>[firstname] [lastname]</td><td>[column1]</td>...<td>[column9]</td></tr>

footer:

</table>

But as I see in output code generated, these no <table> nor <tr><td> tags around the data.
If I understand right this happens beause these parts of HTML code are not valid by separate and are cleaned out by output filters.

To avoid this I had to add 'noclean' option to format_text parameters in print_template function (complete patch in attachment).

But I am surprised that there are nothing about this issue in forum or tracker.
Am I solving the issue right way or there is some trick to make pretty formatted tables, simple and obvious for everyone else? 

Shouldn't the documentation be updated ?

Average of ratings: Useful (3)