MDL-71981 dataformat: indicate HTML support in writer callback.

This commit is contained in:
Paul Holden
2021-07-06 09:29:44 +08:00
committed by Adrian Greeve
parent 1d8512bc0e
commit 80e2f8473e
2 changed files with 11 additions and 3 deletions
+4 -3
View File
@@ -59,7 +59,8 @@ class dataformat {
* @param string $dataformat
* @param array $columns
* @param Iterable $iterator
* @param callable|null $callback
* @param callable|null $callback Optional callback method to apply to each record prior to writing, which accepts two
* parameters as such: function($record, bool $supportshtml) returning formatted record
* @throws coding_exception
*/
public static function download_data(string $filename, string $dataformat, array $columns, Iterable $iterator,
@@ -89,7 +90,7 @@ class dataformat {
$rownum = 0;
foreach ($iterator as $row) {
if (is_callable($callback)) {
$row = $callback($row);
$row = $callback($row, $format->supports_html());
}
if ($row === null) {
continue;
@@ -131,7 +132,7 @@ class dataformat {
$rownum = 0;
foreach ($iterator as $row) {
if (is_callable($callback)) {
$row = $callback($row);
$row = $callback($row, $format->supports_html());
}
if ($row === null) {
continue;